Skip to content

Instantly share code, notes, and snippets.

@kanazux
Last active August 29, 2015 14:26
Show Gist options
  • Save kanazux/7f6536f4fb25c292f5e6 to your computer and use it in GitHub Desktop.
Save kanazux/7f6536f4fb25c292f5e6 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Kanazuchi <[email protected]>
#
import os
import re
for x in [ x for x in os.listdir('.') if '.mp4' in x ]:
for y in [ y for y in os.listdir('.') if '.srt' in y ]:
if x.lower().split('.')[1] == re.sub('s01e','1',y.lower().split('.')[1]):
os.rename(x, ".".join(
[x.lower().split('.')[0],x.lower().split('.')[1],x.lower().split('.')[-1]]))
new_y = re.sub('s01e', '1', y.lower().split('.'))
os.rename(y, ".".join([new_y[0], new_y[1], new_y[-1]]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment