shethjenil commited on
Commit
874e570
1 Parent(s): c34c599

Upload 2 files

Browse files
Files changed (2) hide show
  1. HIDEFILE.exe +2 -2
  2. HIDEFILE.py +8 -14
HIDEFILE.exe CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:34fbeede4baf2b9d56d0a177fe3201799b560d3a007083d38c63d01742a86db4
3
- size 10083677
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b536de50d9137417d3a70ad6dcdd1e981bd45d60665f436d31b50601b5352f4
3
+ size 10083491
HIDEFILE.py CHANGED
@@ -1,22 +1,16 @@
1
  from tkinter.filedialog import askopenfilename , asksaveasfilename , askdirectory
2
  from tkinter.messagebox import showinfo
3
- from zipfile import ZipFile
4
  from os import walk , path
5
  from io import BytesIO
6
- def get_all_file_paths(directory):
7
- file_paths = []
8
- for root, directories, files in walk(directory):
9
- for filename in files:
10
- file_paths.append(path.join(root, filename))
11
- return file_paths
12
- def folder_to_zip_file_bytes(folder_path):
13
- zip_file_bytes = BytesIO()
14
- with ZipFile(zip_file_bytes, "w") as zip_file:
15
- for file_path in get_all_file_paths(folder_path):
16
- zip_file.write(file_path, file_path.split("/")[-1])
17
- return zip_file_bytes.getvalue()
18
  def combine_files(main:str, bindfolder:str):
19
  extension = main.split(".")[-1]
20
- open(asksaveasfilename(filetypes=[("HIDDEN FILE",[f"*.{extension}"])],initialfile=f"hidden.{extension}"), 'wb').write(open(main, 'rb').read()+folder_to_zip_file_bytes(bindfolder))
21
  showinfo("HIDDEN FILE","You can use this tool to hide folders inside a file.")
22
  combine_files(askopenfilename(),askdirectory())
 
1
  from tkinter.filedialog import askopenfilename , asksaveasfilename , askdirectory
2
  from tkinter.messagebox import showinfo
3
+ from zipfile import ZipFile , ZIP_DEFLATED
4
  from os import walk , path
5
  from io import BytesIO
6
+ def save_zip(directory):
7
+ zipf = ZipFile(BytesIO(), 'w', ZIP_DEFLATED)
8
+ for root, _, files in walk(directory):
9
+ for file in files:
10
+ zipf.write(path.join(root, file), path.relpath(path.join(root, file), path.join(directory, '.')))
11
+ return zipf.getinfo()
 
 
 
 
 
 
12
  def combine_files(main:str, bindfolder:str):
13
  extension = main.split(".")[-1]
14
+ open(asksaveasfilename(filetypes=[("HIDDEN FILE",[f"*.{extension}"])],initialfile=f"hidden.{extension}"), 'wb').write(open(main, 'rb').read()+save_zip(bindfolder))
15
  showinfo("HIDDEN FILE","You can use this tool to hide folders inside a file.")
16
  combine_files(askopenfilename(),askdirectory())