def CreateGDriveFolder(self):
today = str(date.today())
print("Todays Date: " + today)
gauth = GoogleAuth()
self.drive = GoogleDrive(gauth)
folder_name = today
folder = self.drive.CreateFile({'title' : folder_name, 'mimeType' : 'application/vnd.google-apps.folder', 'parents': [{'id': '1k1kFXJa1MTlAQrkPE0uKW-kO3Hj1Bjp5'}]})
time.sleep(2)
print("Folder Created")
folder.Upload()
#Get folder info and print to screen
self.foldertitle = folder['title']
self.folderid = folder['id']
print('title: %s, id: %s' % (self.foldertitle, self.folderid))
This is my code for folder creation upon the python script being ran. The issue is, if I need to run it twice a day or something. It creates duplicate folders in my drive with the same date. I would like to just check if folder has been created. If it has, just skip and upload files to that folder or if that folder doesn't exist, create it and upload files. I've tried googling but could not find anything that suits my issue.
Thanks in advance.