diff --git a/split_zip_into_under_5GB_chunks.py b/split_zip_into_smaller_chunks.py similarity index 83% rename from split_zip_into_under_5GB_chunks.py rename to split_zip_into_smaller_chunks.py index 2d31f05..47571e7 100755 --- a/split_zip_into_under_5GB_chunks.py +++ b/split_zip_into_smaller_chunks.py @@ -24,6 +24,20 @@ def printProgressBar(iteration, total, prefix = '', suffix = '', decimals = 1, l if iteration == total: print() +def can_float(str): + try: + float(str) + return True + except ValueError: + return False + +def get_max_size(): + while True: + mx_group_size = input("Enter the maximum (in GB) zipped file size: ") + if can_float(mx_group_size): + return float(mx_group_size) + else: + print(f"You did not enter a number. Please try again.") def get_zip_path(): while True: @@ -33,7 +47,8 @@ def get_zip_path(): else: print(f"The file at {zip_path} does not exist. Please try again.") -def split_zip(input_zip_path, output_folder, max_group_size=4.5 * 1024 * 1024 * 1024): +def split_zip(input_zip_path, output_folder, max_group_size): + max_group_size = max_group_size * 1024 * 1024 * 1024 # Ensure the output folder exists base = os.path.basename(input_zip_path) file_name = os.path.splitext(base)[0] @@ -72,7 +87,8 @@ def split_zip(input_zip_path, output_folder, max_group_size=4.5 * 1024 * 1024 * # Example usage # input_zip_path = 'path/to/your/large.zip' +max_group_size = get_max_size() input_zip_path = get_zip_path() output_folder = 'output' -split_zip(input_zip_path, output_folder) +split_zip(input_zip_path, output_folder, max_group_size)