Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import shutil
- import traceback
- rubbish = ['HDrip', 'Xvid', 'ac3', 'evo', 'HC', 'DVDSCR', 'HQ', 'hive', 'CM8', 'ENG', 'FXG', 'THC', '[', ']', 'Bluray', 'x264', '-', '_', 'THORA', 'WEB', 'DL', 'DD5.1', 'H264', 'FGT']
- #tags = ['.avi', '.mkv', '.mp4', '.wmv']
- source = os.path.curdir
- #test = [t.replace(rubbish, '') for t in test]
- def torRename(source):
- for f in os.listdir(source):
- if os.path.isfile(f):
- if f.lower().endswith('mp4'):
- for element in rubbish:
- y = f.lower()
- new = y.replace('bluray', '')
- if new != f:
- try:
- print(new)
- print('File has changed')
- os.rename(f, new)
- except FileNotFoundError:
- print("File not found")
- torRename(source)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement