Skip to content

Instantly share code, notes, and snippets.

@hendrikleper
hendrikleper / move.py
Last active December 16, 2018 23:07 — forked from ikluhsman/move.py
Python: move files to creation date named directories
#!/usr/local/bin/python3
#use with 'python move.py /myDirectory/'
import os, time, shutil, sys
dir = sys.argv[1]
os.chdir(dir)
for f in os.listdir('.'):
ftime = time.gmtime(os.path.getmtime(f))
year = str(ftime.tm_year)
mon = str(ftime.tm_mon)