From 66bd40e2b94cd07bd966f162a08b0ad0e51bedac Mon Sep 17 00:00:00 2001 From: Steven Crawford Date: Sat, 21 Dec 2024 10:11:13 -0600 Subject: [PATCH] updates --- cmg-split-zip-smaller-chunks.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/cmg-split-zip-smaller-chunks.py b/cmg-split-zip-smaller-chunks.py index 771b89b..0dca869 100755 --- a/cmg-split-zip-smaller-chunks.py +++ b/cmg-split-zip-smaller-chunks.py @@ -2,6 +2,7 @@ import zipfile import os from io import BytesIO +import argparse def printProgressBar(iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█', printEnd = "\r"): """ @@ -89,8 +90,30 @@ def split_zip(input_zip_path, output_folder, max_group_size): # Example usage # input_zip_path = 'path/to/your/large.zip' -max_group_size = get_max_size() -input_zip_path = get_zip_path() + +# Create an argument parser object +parser = argparse.ArgumentParser(description='Check for a specific flag.') +# Add a flag argument to the parser +parser.add_argument('-gs', '--group_size', help='Specify Group Size') +parser.add_argument('-f', '--file_location', help='Specify File Location') + +# Parse the command-line arguments +args = parser.parse_args() + +if args.group_size: + mx_group_size = args.group_size + if can_float(mx_group_size): + max_group_size = float(mx_group_size) + else: + max_group_size = get_max_size() +else: + max_group_size = get_max_size() + +if args.file_location: + input_zip_path = args.file_location +else: + input_zip_path = get_zip_path() + output_folder = 'output' split_zip(input_zip_path, output_folder, max_group_size)