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()))