Created
January 10, 2013 09:14
-
-
Save exaos/4500671 to your computer and use it in GitHub Desktop.
Split ISO-date to subdirs: e.g. 2012-12-12/*.* ==> 2012/12/12/*.*
This file contains hidden or 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 shutil, os, sys | |
def dest_name(d_name): | |
d_tmp = d_name.split('-') | |
if d_tmp and d_tmp[0] != d_name: | |
return os.path.join('.',*d_tmp) | |
return None | |
names = os.listdir(ur'.') | |
for d in names: | |
d_dest = dest_name(d) | |
if d_dest: shutil.move(d, d_dest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment