Last active
September 15, 2022 19:41
-
-
Save oguzhari/907117bba659a5eabce9fc80f7ee2981 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def save_files(): | |
| gauth = GoogleAuth() | |
| create_cred_file() | |
| gauth.LoadCredentialsFile('mycreds.txt') | |
| drive = GoogleDrive(gauth) | |
| folder_name = 'test' # Please set the folder name. | |
| folders = drive.ListFile( | |
| { | |
| 'q': "title='" + folder_name + "' and mimeType='application/vnd.google-apps.folder' and trashed=false"}).GetList() | |
| for folder in folders: | |
| if folder['title'] == folder_name: | |
| for created_file in created_files: | |
| file = drive.CreateFile({'parents': [{'id': folder['id']}]}) | |
| file.SetContentFile(created_file) | |
| file.Upload() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment