Skip to content

Instantly share code, notes, and snippets.

@Luzifer
Created August 1, 2013 14:32
Show Gist options
  • Save Luzifer/6131936 to your computer and use it in GitHub Desktop.
Save Luzifer/6131936 to your computer and use it in GitHub Desktop.
Moving files named in schema %Y%m%d_something.pdf into folders %Y/%m/filename.pdf
for i in *.pdf; do I=$(echo $i | sed "s/^\(\([0-9]\{4\}\)\([0-9]\{2\}\).*\)$/\2\/\3\/\1/"); mkdir -p $(dirname $I) && mv $i $I; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment