From ae90c64885295e40e72ec6cf94ca35562eb65a1c Mon Sep 17 00:00:00 2001 From: neingeist Date: Wed, 11 Jul 2018 12:43:29 +0200 Subject: [PATCH] initial commit --- drive-download.py | 21 +++++++++++++++++++++ requirements.txt | 1 + 2 files changed, 22 insertions(+) create mode 100644 drive-download.py create mode 100644 requirements.txt diff --git a/drive-download.py b/drive-download.py new file mode 100644 index 0000000..42abded --- /dev/null +++ b/drive-download.py @@ -0,0 +1,21 @@ +FOLDER = '1J_Yw3ENBfDOEjiPV2LpYIa86aAPnaVx3' + +import os +from pydrive.auth import GoogleAuth +from pydrive.drive import GoogleDrive + +gauth = GoogleAuth() +gauth.CommandLineAuth() + +drive = GoogleDrive(gauth) + +file_list = drive.ListFile({'q': "'{}' in parents and trashed=false".format(FOLDER)}).GetList() +for file1 in file_list: + if file1['mimeType'] == 'application/vnd.google-apps.folder': + continue + local_filename = file1['title'] + print(local_filename) + if not os.path.exists(local_filename): + file1.GetContentFile(local_filename) + else: + raise "{} exists".format(local_filename) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ddcd7fa --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pydrive