From: Jakub Czajka Date: Wed, 15 Nov 2023 22:35:21 +0000 (+0100) Subject: Add a flag to disable unarchiving after download. X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=3d8fb373c6c90bf271c3e1228c0393918c2a72ee;p=gdrive_knife.git Add a flag to disable unarchiving after download. --- diff --git a/gdrive_knife.py b/gdrive_knife.py index 312805f..af0bda7 100644 --- a/gdrive_knife.py +++ b/gdrive_knife.py @@ -136,7 +136,7 @@ def download(args): decrypt_chunks_in_place(args.key, path_in_tmp) print(f'{args.path} decrypted.') - if zipfile.is_zipfile(path_in_tmp): + if zipfile.is_zipfile(path_in_tmp) and not args.leave_as_archive: os.makedirs(args.output, exist_ok=True) shutil.unpack_archive(path_in_tmp, extract_dir=args.output, format='zip') print(f'Unarchived to {args.output}.') @@ -226,6 +226,8 @@ if __name__ == '__main__': download_parser.add_argument('-t', dest='token', required=True, type=lambda x : file_path(parser, x), help='File with the ' 'authentication token.') + download_parser.add_argument('--leave-as-archive', action='store_true', + help='Do not unarchive a directory after download.') download_parser.set_defaults(func=download) upload_parser = subparsers.add_parser('upload', help='Upload a file. '