updated to ask for file size and renamed appropriately
This commit is contained in:
@@ -24,6 +24,20 @@ def printProgressBar(iteration, total, prefix = '', suffix = '', decimals = 1, l
|
|||||||
if iteration == total:
|
if iteration == total:
|
||||||
print()
|
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():
|
def get_zip_path():
|
||||||
while True:
|
while True:
|
||||||
@@ -33,7 +47,8 @@ def get_zip_path():
|
|||||||
else:
|
else:
|
||||||
print(f"The file at {zip_path} does not exist. Please try again.")
|
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
|
# Ensure the output folder exists
|
||||||
base = os.path.basename(input_zip_path)
|
base = os.path.basename(input_zip_path)
|
||||||
file_name = os.path.splitext(base)[0]
|
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
|
# Example usage
|
||||||
# input_zip_path = 'path/to/your/large.zip'
|
# input_zip_path = 'path/to/your/large.zip'
|
||||||
|
max_group_size = get_max_size()
|
||||||
input_zip_path = get_zip_path()
|
input_zip_path = get_zip_path()
|
||||||
output_folder = 'output'
|
output_folder = 'output'
|
||||||
|
|
||||||
split_zip(input_zip_path, output_folder)
|
split_zip(input_zip_path, output_folder, max_group_size)
|
||||||
Reference in New Issue
Block a user