
Web authentication is required again if SCOPES changed.Ĭreative Commons Attribution-NonCommercial 4.0 International License. To review, open the file in an editor that reveals hidden Unicode characters. NOTE: Web authentication is only required the first time, after which the authorization should be stored in TOKEN_FILE. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. NOTE: The script only check filename, and doesn’t reupload file when content changed but filename doesn’t change. Service = build( 'drive', 'v3', http =creds.

flow_from_clientsecrets(CREDENTIAL_FILE, SCOPES) TOKEN_FILE = 'gdrive_sync_token.json' def sync_folder(local_folder, gdrive_folder_name):įlow = client. Import os import glob from googleapiclient.discovery import buildįrom googleapiclient.http import MediaFileUploadįrom oauth2client import file as oauth2file, client, toolsĬREDENTIAL_FILE = 'gdrive_sync_credential.json'
