updated to ask for file size and renamed appropriately

This commit is contained in:
2024-12-12 12:08:13 -06:00
parent 2f63fcb905
commit 6961f59253

View File

@@ -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)