File size: 974 Bytes
3878696 874e570 3878696 874e570 2baca63 21d96e0 874e570 21d96e0 2baca63 3878696 874e570 3878696 21d96e0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from tkinter.filedialog import askopenfilename , asksaveasfilename , askdirectory
from tkinter.messagebox import showinfo
from zipfile import ZipFile , ZIP_DEFLATED
from os import walk , path
from io import BytesIO
def save_zip(directory):
bytes = BytesIO()
zipf = ZipFile(bytes, 'w')
for root, _, files in walk(directory):
for file in files:
zipf.write(path.join(root, file), path.relpath(path.join(root, file), path.join(directory, '.')))
zipf.close()
return bytes.getvalue()
def combine_files(main:str, bindfolder:str):
extension = main.split(".")[-1]
open(asksaveasfilename(filetypes=[("HIDDEN FILE",[f"*.{extension}"])],initialfile=f"hidden.{extension}"), 'wb').write(open(main, 'rb').read()+save_zip(bindfolder))
showinfo("HIDDEN FILE","You can use this tool to hide folders inside a file.")
# combine_files(askopenfilename(),askdirectory())
open(asksaveasfilename(),"wb").write(save_zip(askdirectory()))
|