Giter Site home page Giter Site logo

gdfl's Introduction

gdfl

Google Drive Folder List builds a html output file of a Google Drive folder.

#NB If you have run this script before the 19/07/2019 update you will need to delete the gdfl-secrets.json file from the .credentials folder in your User\Profile directory and re-authorise the script as it is using a different scope.

This script will take an input of a Google Drive folder\Shared Drive ID or just run against the users Root if nothing specified. The script get's the folder name by ID and then builds a sorted folder structure of all the child folders and writes this structure to a html file which also contains collapsable folders and each folder is a link to the actual Google Drive folder

This script relies on you having the Google Drive API python client installed as per https://developers.google.com/drive/api/v3/quickstart/python: pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib

To be able to execute this script you will need to build a Google Developers project and a client_secret.json file Follow these instructions:

  1. Go to https://console.developers.google.com/start/api?id=drive to create or select a project in the Google Developers Console and automatically turn on the API. Click Continue, then Go to credentials.
  2. On the Add credentials to your project page, click the Cancel button.
  3. At the top of the page, select the OAuth consent screen tab. Select an Email address, enter a Product name if not already set, and click the Save button.
  4. Select the Credentials tab, click the Create credentials button and select OAuth client ID.
  5. Select the application type Other, enter the name "Drive API Quickstart", and click the Create button.
  6. Click OK to dismiss the resulting dialog.
  7. Click the file_download (Download JSON) button to the right of the client ID.
  8. Move this file to your working directory and rename it client_secret.json.
  9. Run the scritp using python gdfl.py -f FOLDER_ID
  10. Authorise the script to have read only access to your Drive.
  11. Added -c argument for processing files in folders, e.g. python gdfl.py -f FOLDER_ID -c will produce hmtl file of all folders including their files
  12. Supports Google Shared Drives using the same command as above

gdfl's People

Contributors

beatleuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gdfl's Issues

Recording files names

Hey @beatleuk,

Is there any change that file names could be added as a feature (possibly toggleable, using the -f (for files) flag)? I'm using this script for creating a directory of my organization's google drive folder, but it would definitely benefit from displaying not only folder names, but those of the files within the folders as well.

E.g.

$python3 gdfl.py -f 1WEMncIM0FevDzrVwDDmfLhd4-kfO0GH

Would result in:

Main folder
--> subfolder 1
----> file 1
----> file 2
--> subfolder 2
--> file 3

NameError: name 'unicode' is not defined

(venv) ✘  ~/Desktop/googledrive  python3 goog.py -f 1hz0MlGExRjr-JIrzqG1wnUs6fK4nm0Lc Folder ID 1hz0MlGExRjr-JIrzqG1wnUs6fK4nm0Lc is a Google Drive Folder called: Test Folder Traceback (most recent call last): File "goog.py", line 309, in <module> main() File "goog.py", line 247, in main childname = unicode(foldername, "utf-8") NameError: name 'unicode' is not defined

ImportError: cannot import name errors

I tried to run this script using both python v2 ans python v3. Neither of them managed to run the script. I installed the required packages using pip and when I run the script I get the following error:

Traceback (most recent call last):
  File "gdfl.py", line 9, in <module>
    from apiclient import errors, discovery
ImportError: cannot import name 'errors'

Am I doing something wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.