diff --git a/filebot.py b/filebot.py index f5adb2e..d20f064 100644 --- a/filebot.py +++ b/filebot.py @@ -10,6 +10,12 @@ import re source_path = Path('/mnt/Download/finished/') dest_path = '/mnt/Download/PostProcess/' +section_folders = ['4K-Movies', '4K-Series', 'Movies', 'Series', ''] + +# source_path = 'C:/Test/finished' +# dest_path = "C:/Test/PostProcess" + + print("Checking if rar files and unraring...") for root, dirs, files in os.walk(source_path): for dir in dirs: @@ -25,6 +31,9 @@ for root, dirs, files in os.walk(source_path): if re.search(r'\.r\d{2,3}', file) or file.endswith('.rar') or file.endswith('.sfv') or file.endswith('.nfo'): os.remove(os.path.join(root, file)) -print(f"Moving files from {source_path} to {dest_path}") -for src_folder in source_path.iterdir(): - shutil.move(src_folder, dest_path) \ No newline at end of file +for root, dirs, files in os.walk(source_path): + for dir in dirs: + if dir not in section_folders: + match = re.search(r'.*\/(.*)', root) + section_path = match.group(1) + shutil.move(os.path.join(root, dir), os.path.join(dest_path, section_path)) \ No newline at end of file