From f61040cf037c0136a94046daafc8ab3d966d7886 Mon Sep 17 00:00:00 2001 From: Jakub Czajka Date: Wed, 8 Nov 2023 21:09:02 +0100 Subject: [PATCH] Remove temporary file after upload and download. --- gdrive_knife.py | 7 +++++++ 1 file changed, 7 insertions(+) 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) -- 2.39.5