简体   繁体   中英

PyDrive How to Download a Folder using ID

I am trying to download a file or folder from My Google drive using PyDrive

After multiple attempts using the Documents: https://gsuitedevs.github.io/PyDrive/docs/build/html/filemanagement.html#download-file-conte

I still cannot seem to get my head around downloading the folder.

I have managed to list the Title and ID of my items, i just need a way to download them.

Upon listing the folders and files both with ID and title Is there any way of downloading the folder based on the ID.

Thanks

As you have managed to get the Titles and IDs of your files. You can download them like this:

file = drive.CreateFile({'id': "ID_OF_YOUR_FILE"})
file.GetContentFile('FILE_NAME_AS_YOU_WANT_TO_SAVE.EXTENSION')

I hope that helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM