Refactor zipremove.py to handle both directories and ZIP files as input
This commit is contained in:
parent
7004c40071
commit
069c88fc45
1 changed files with 9 additions and 3 deletions
12
zipremove.py
12
zipremove.py
|
@ -27,8 +27,14 @@ def process_directory(directory_path):
|
|||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python script.py <directory_path>")
|
||||
print("Usage: python script.py <path_to_directory_or_zip>")
|
||||
sys.exit(1)
|
||||
|
||||
directory_path = sys.argv[1]
|
||||
process_directory(directory_path)
|
||||
path = sys.argv[1]
|
||||
if os.path.isdir(path):
|
||||
process_directory(path)
|
||||
elif os.path.isfile(path) and path.endswith('.zip'):
|
||||
print(f"Processing {path}")
|
||||
filter_and_repack_zip(path)
|
||||
else:
|
||||
print("The path is not a directory or a ZIP file.")
|
||||
|
|
Loading…
Reference in a new issue