zipmind-cli 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
zip_cleaner/cli.py ADDED
@@ -0,0 +1,44 @@
1
+ import argparse
2
+
3
+ from zip_cleaner.reader import list_zip_contents
4
+ from zip_cleaner.filter import filter_files
5
+ from zip_cleaner.rebuilder import create_clean_zip
6
+
7
+
8
+ def main():
9
+ parser = argparse.ArgumentParser(
10
+ description="Clean unwanted folders from zip files"
11
+ )
12
+
13
+ parser.add_argument(
14
+ "zipfile",
15
+ help="Path to the zip file"
16
+ )
17
+
18
+ parser.add_argument(
19
+ "--remove",
20
+ nargs="+",
21
+ required=True,
22
+ help="Folders to remove"
23
+ )
24
+
25
+ parser.add_argument(
26
+ "--output",
27
+ default="cleaned.zip",
28
+ help="Output zip file name"
29
+ )
30
+
31
+ args = parser.parse_args()
32
+
33
+ files = list_zip_contents(args.zipfile)
34
+
35
+ if files:
36
+ cleaned_files = filter_files(files, args.remove)
37
+
38
+ create_clean_zip(
39
+ args.zipfile,
40
+ cleaned_files,
41
+ args.output
42
+ )
43
+
44
+ print("\nProcess completed successfully!")
zip_cleaner/filter.py ADDED
@@ -0,0 +1,18 @@
1
+ def filter_files(file_list, remove_folders):
2
+ filtered = []
3
+
4
+ for file in file_list:
5
+
6
+ should_skip = False
7
+
8
+ for folder in remove_folders:
9
+ if folder in file:
10
+ should_skip = True
11
+ break
12
+
13
+ if should_skip:
14
+ continue
15
+
16
+ filtered.append(file)
17
+
18
+ return filtered
zip_cleaner/reader.py ADDED
@@ -0,0 +1,10 @@
1
+ import zipfile
2
+
3
+ def list_zip_contents(zip_path):
4
+ try:
5
+ with zipfile.ZipFile(zip_path, 'r') as zip_ref:
6
+ return zip_ref.namelist()
7
+ except FileNotFoundError:
8
+ print("Error: Zip file not found.")
9
+ except zipfile.BadZipFile:
10
+ print("Error: Invalid zip file.")
@@ -0,0 +1,17 @@
1
+ import zipfile
2
+
3
+
4
+ def create_clean_zip(zip_path, cleaned_files, output_name="cleaned.zip"):
5
+ try:
6
+ with zipfile.ZipFile(zip_path, 'r') as zip_in:
7
+ with zipfile.ZipFile(output_name, 'w') as zip_out:
8
+
9
+ for file in cleaned_files:
10
+ data = zip_in.read(file)
11
+ zip_out.writestr(file, data)
12
+ print(f"Cleaned zip created: {output_name}")
13
+
14
+ except FileNotFoundError:
15
+ print("Error: Original zip file not found.")
16
+ except zipfile.BadZipFile:
17
+ print("Error: Invalid zip file.")
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.4
2
+ Name: zipmind-cli
3
+ Version: 0.1.0
4
+ Summary: A CLI tool to clean unwanted folders from zip files
5
+ Author: Your Name
6
+ Requires-Python: >=3.8
7
+ License-File: LICENSE
8
+ Dynamic: license-file
@@ -0,0 +1,11 @@
1
+ zip_cleaner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ zip_cleaner/cli.py,sha256=uYMGUZcW4tgKhnlN5oCoHGtey7Pgd6yCEJMkz_2aYiw,953
3
+ zip_cleaner/filter.py,sha256=iuuBWOnmcPfl01CJF2qr6Lre1wtIqNlIw6G32WXr3Wo,361
4
+ zip_cleaner/reader.py,sha256=reAKhZAF2A9oBtiKIDbV3U6q3J6NmNg4Aqd8Vma0LoQ,307
5
+ zip_cleaner/rebuilder.py,sha256=mLdM4U_QKiXw_HdPx1uhVZp96-SH_CTdqH0XJgPIuSE,598
6
+ zipmind_cli-0.1.0.dist-info/licenses/LICENSE,sha256=ZP4tct8FeVtCXP7k72-fwGcaJhu1uHklqcU-XQqux0o,1091
7
+ zipmind_cli-0.1.0.dist-info/METADATA,sha256=Aaa9SfnSnGVkxiPRcywqfk1JbfKru_Ge1stp1wDqAwY,209
8
+ zipmind_cli-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
9
+ zipmind_cli-0.1.0.dist-info/entry_points.txt,sha256=kQuz2_lxTDfI9BILAhbMc8nVWbLXmL0PB0DzUThy4bY,53
10
+ zipmind_cli-0.1.0.dist-info/top_level.txt,sha256=xS2dZb1FSx1q6wtKibU_LBWJXSi2N6uUPSdvLkD9mgo,12
11
+ zipmind_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ zip-cleaner = zip_cleaner.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Senuda Dilvan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ zip_cleaner