Initial commit

This commit is contained in:
Juul
2026-04-17 16:01:09 +02:00
commit bf23d2f0cc
6 changed files with 218 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
from tkinter.filedialog import askdirectory
from tkinter import Tk
import os
import subprocess
import hashlib
from pathlib import Path
sevenzip = r"C:\Program Files\7-Zip\7z.exe"
# We don't want the GUI window of
# tkinter to be appearing on our screen
Tk().withdraw()
# Dialog box for selecting a folder.
file_path = askdirectory(title="Select a folder")
# Listing out all the files
# inside our root folder.
list_of_files = os.walk(file_path)
for root, folders, files in list_of_files:
for file in files:
file_path = Path(os.path.join(root, file))
name, _ = os.path.splitext(file_path)
zipped_filename = f"{name}.7z"
if not os.path.isfile(zipped_filename):
try:
subprocess.run([sevenzip, 'a', zipped_filename, file_path], check=True)
except:
input("")
exit()