Skip to content

This library allows you to easily interact with Drive, as it was a common file system. Create folders, upload files, remove files, list directories and more. Also, it understands string paths, like 'path/to/my/folder/foo.txt'

License

Notifications You must be signed in to change notification settings

YoelMonsalve/GoogleDrivePythonLibrary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoogleDrivePythonLibrary

This library allows you to easily interact with Drive, as it was a common file system. Create folders, upload files, remove files, list directories and more. Also, it understands string paths, like 'path/to/folder/foo.txt' This is created as a way to notably increase the easiness of the official Google Drive API library, by adding a set of high-level methods.

References

Methods

Low level methods

  • Init a service from your client_secret (reference)
  • List all files (folders are also considered files) matching a query (reference)
  • List all entries under a directory, understanding a string path syntax (e.g. 'path/to/folder/')
  • List folders under a parent ID
  • List all files under a parent ID
  • Delete all folders with a given name and parentID
  • Delete all files with a given name and parentID
  • getFileNameById: get a file name from its ID.
  • getMimeTypeById: get a file MIME type from its ID.

High level methods

  • getFileId: get a file ID from string path.
  • serchFile: return the basic attributes of a file (id, name, size, mimeType, modifiedTime, parents) from a string path.
  • copyToFolder: copy a file to another folder. This understands string paths.
  • moveToFolder: move a file to another folder. This understands string paths.
  • rename: rename a file
  • createFolder: create a folder under the root location of Drive. Understands string paths, and you can created nested folder in a way: e.g. createFolder('/my/new/folder') will create a new folder root->my->new->folder
  • uploadFile: upload a file to an existing remote folder, allowing you to specify a different name. Example, upload_file('foo.txt','foo2.txt', dest='my/folder') will create the new file my/folder/foo2.txt with the content of foo.txt
  • remove: remove a file by string path, e.g. remove('/my/path/foo.txt')
  • sync: automatically synchronize a local folder with a remote drive folder. I will traverse recursively the local folder, recreating the folders structure in the remote, and uploading/updating files if size is different or modification time is newer in local. Example: sync('my/local/folder','/remote/folder/'). In this context, the dealing / in the remote path stands for the root folder of Drive.

About

This library allows you to easily interact with Drive, as it was a common file system. Create folders, upload files, remove files, list directories and more. Also, it understands string paths, like 'path/to/my/folder/foo.txt'

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published