Created
December 8, 2020 13:02
-
-
Save tossmilestone/972658dab69cbbca8a3de05dc6170821 to your computer and use it in GitHub Desktop.
A simple batch rename python script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
regex = r"\[(\d+)\]" | |
for f in os.listdir("./"): | |
if f.endswith(".mp4"): | |
matches = re.finditer(regex, f, re.MULTILINE) | |
for num, match in enumerate(matches, start=1): | |
ep = match.group(1) | |
print(r'TV.%s.mp4' % ep) | |
os.rename(f, r'TV.%s.mp4' % ep) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment