Created
March 27, 2015 15:40
-
-
Save andyreagan/a41b435c188b4204396b to your computer and use it in GitHub Desktop.
Inspired by my neurotic need to keep my downloads folder clean, naming via Peter Dodds
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 datetime | |
if __name__ == '__main__': | |
for file in os.listdir('.'): | |
if not file == 'flowify.py': | |
t = os.path.getmtime(file) | |
d = datetime.datetime.fromtimestamp(t) | |
if not os.path.isdir(d.strftime('/Users/andyreagan/flow/%Y/%m')): | |
os.mkdir(d.strftime('/Users/andyreagan/flow/%Y/%m')) | |
os.rename(file,'/Users/andyreagan/flow/{0}/{1}'.format(d.strftime('%Y/%m'),file)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment