From: Jakub Czajka Date: Wed, 8 Nov 2023 20:09:02 +0000 (+0100) Subject: Remove temporary file after upload and download. X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=f61040cf037c0136a94046daafc8ab3d966d7886;p=gdrive_knife.git Remove temporary file after upload and download. --- diff --git a/gdrive_knife.py b/gdrive_knife.py index 81e3076..605ea7e 100644 --- a/gdrive_knife.py +++ b/gdrive_knife.py @@ -146,6 +146,10 @@ def download(args): shutil.move(path_in_tmp, destination) print(f'Moved to {destination}.') + if os.path.exists(path_in_tmp): + os.remove(path_in_tmp) + print(f'Removed {path_in_tmp}.') + def upload(args): drive = get_drive_client(args.token) @@ -178,6 +182,9 @@ def upload(args): drive.files().create(body=body, media_body=media).execute() print(f'Created {path} on drive.') + os.remove(path_in_tmp) + print(f'Removed {path_in_tmp}.') + def delete(args): drive = get_drive_client(args.token)