Skip to content

Instantly share code, notes, and snippets.

@vesche
Created June 14, 2018 03:38
Show Gist options
  • Save vesche/04b462bf3158e4ea8c9d8d078920547f to your computer and use it in GitHub Desktop.
Save vesche/04b462bf3158e4ea8c9d8d078920547f to your computer and use it in GitHub Desktop.
library quality mass rename
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
hacky mass rename with quality
let's hope this doesn't fuck up
"""
import os
for d in os.listdir('.'):
try:
files = os.listdir(d)
except NotADirectoryError:
continue
for f in files:
if '720' in f: q = '720'
if '1080' in f: q = '1080'
if '576' in f: q = '576'
if '480' in f: q = '480'
try:
q
except NameError:
continue
os.system( 'mv "{}" "{}"'.format(d, d+' [{}]'.format(q)) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment