How do I upload mp4 files to google drive?

  google-drive-api, operating-system, python, windows

So I am trying to create a script that will take my latest gaming clip and upload it to my google drive so I can access it on my phone. Right now, this script uploads two files to my google drive that are named the same but I cannot open them. The two files are named: "C:UsersethanVideosRadeon ReLiveReplay_2020.12.03-00.04.mp4".I just want one mp4 file to show up. This is my first time using the google API so I am thankful for any help. Thanks!

import os.path
from pydrive.drive import GoogleDrive 
from pydrive.auth import GoogleAuth 

path = r'C:UsersethanVideosRadeon ReLive'
filelist = [os.path.join(path, f) for f in os.listdir(path)]
filelist = [f for f in filelist if os.path.isfile(f)]
newest = max(filelist, key=lambda x: os.stat(x).st_mtime)
print(newest)


gauth = GoogleAuth() 
gauth.LocalWebserverAuth()        
drive = GoogleDrive(gauth) 
file1 = drive.CreateFile({'title': newest})
file1.Upload() 

Source: Windows Questions

LEAVE A COMMENT