# new Directory instance then listing the contents of that as wellĪbs_path = ff.abs_path_from_local_dir(self.directory_path, fd) # if its a dir and full_tree=true, make a recursive call by creating # loop through files and directories, outputting if its a file or dir # sorts the files and dirs so their alphabetical and files come firstįf.sort_files_and_dirs(self.directory_path, files_and_dirs) # create the files_and_dirs list in the current directory # parent_dir_id = id of the parent dir on Google drive # google_drive_folder = name of the current directory Object, with 'google_drive_folder' as the ROOT directory """Creates the same tree in google drive that is in the Directory #print("_INIT_ DIR PATH=" + self.directory_path)
Here is my Directory Class: class Directory(): Start_directory.create_google_drive_tree( # '1YOTDKowprC2Paq95X-MIKSUG_vpuViQw' is the id of HOME-SYNC on # create the directory tree on google drive Google_service = ff.create_google_token() # create a directory object with start path Start_path = ff.abs_path_from_user_input(start_path) # in the future need to ask if want to backup HOME-SYNC first, and if # structure on local machine to HOME-SYNC # assuming HOME-SYNC is empty, for now first step is copying directory Print("4: upload to HOME-SYNC on Google Drive") Here is my main program: # user wants to upload to Google Drive HOME-SYNC Is there a faster way I can accomplish it, maybe with a single request instead of a request for each file? I'm practicing with a small directory for now, but when I have 2000 files in the future it will take for-ev-er. I can accomplish this in Python fine and the files upload, but it goes 1 file at a time with a request to the API with each file and its very slow. I'm trying to upload a directory and all of its contents to Google Drive.