Created
April 11, 2018 23:13
-
-
Save duhaime/d50c6c17994a37f0c9992e3dfb4fd974 to your computer and use it in GitHub Desktop.
Nest files into subdirectories for AFS filesystems
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 glob | |
for i in range(10): | |
for j in range(10): | |
for k in range(10): | |
outdir = '/'.join([str(l) for l in [i,j,k]]) | |
if not os.path.exists(outdir): | |
os.makedirs(outdir) | |
for i in glob.glob('*.jpg'): | |
path = '/'.join([j for j in i[:3]]) | |
cmd = 'mv ' + i + ' ' + path + '/' + i | |
print('running', cmd) | |
os.system('mv ' + i + ' ' + path + '/' + i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment