-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
30 lines (27 loc) · 1.16 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import zipfile, os
for file in os.listdir("./not rats"):
if file.startswith("decompressed_"):
continue
print("Processing: " + file)
if file.endswith(".jar") or file.endswith(".zip"):
with zipfile.ZipFile(f"./not rats/{file}", "r") as zip_ref:
with zipfile.ZipFile(f"./not rats/decompressed_{file}", "w") as zip_writer:
for name in zip_ref.namelist():
zip_writer.writestr(
name, zip_ref.read(name), compress_type=zipfile.ZIP_STORED
)
os.remove(f"./not rats/{file}")
print("Done!")
for file in os.listdir("./rats"):
if file.startswith("decompressed_"):
continue
print("Processing: " + file)
if file.endswith(".jar") or file.endswith(".zip"):
with zipfile.ZipFile(f"./rats/{file}", "r") as zip_ref:
with zipfile.ZipFile(f"./rats/decompressed_{file}", "w") as zip_writer:
for name in zip_ref.namelist():
zip_writer.writestr(
name, zip_ref.read(name), compress_type=zipfile.ZIP_STORED
)
os.remove(f"./rats/{file}")
print("Done!")