This commit is contained in:
Gregory Salaun 2022-01-26 18:42:49 +07:00
parent a65a22ce51
commit 328ad85d21

View File

@ -10,7 +10,7 @@ import re
source_path = Path('/mnt/Download/finished/')
dest_path = '/mnt/Download/PostProcess/'
section_folders = ['4K-Movies', '4K-Series', 'Movies', 'Series', '']
section_folders = ['4K-Movies', '4K-Series', 'Movies', 'Series']
# source_path = 'C:/Test/finished'
# dest_path = "C:/Test/PostProcess"
@ -27,8 +27,10 @@ for root, dirs, files in os.walk(source_path):
print("Deleting rar, sfv, nfo files...")
for root, dirs, files in os.walk(source_path):
for dir in dirs:
if re.search('sample', dir, re.IGNORECASE) or re.search('proof', dir, re.IGNORECASE):
shutil.rmtree(dir)
for file in files:
if re.search(r'\.r\d{2,3}', file) or file.endswith('.rar') or file.endswith('.sfv') or file.endswith('.nfo'):
if re.search(r'\.r\d{2,3}', file) or file.endswith('.rar') or file.endswith('.sfv') or file.endswith('.nfo') or re.search('sample', file, re.IGNORECASE):
os.remove(os.path.join(root, file))
for root, dirs, files in os.walk(source_path):