Skip to content

Instantly share code, notes, and snippets.

@duhaime
Created April 11, 2018 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duhaime/d50c6c17994a37f0c9992e3dfb4fd974 to your computer and use it in GitHub Desktop.
Save duhaime/d50c6c17994a37f0c9992e3dfb4fd974 to your computer and use it in GitHub Desktop.
Nest files into subdirectories for AFS filesystems
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