Skip to content

Instantly share code, notes, and snippets.

@pif
Created March 25, 2015 21:04
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 pif/c59a9cae30983b6e7bc5 to your computer and use it in GitHub Desktop.
Save pif/c59a9cae30983b6e7bc5 to your computer and use it in GitHub Desktop.
Move all Dropbox Camera Uploads files to separate folders. New folder format is YYYY_MM_DD. E.g.: 2015_01_22
~/D/Camera Uploads ❯❯❯ IFS=$'\n'; for f in $(ls | cat)
do
folder=$(echo $f | sed "s/\(\) \([0-9][0-9]\.[0-9][0-9]\.[0-9][0-9].*\)/\1/g" | sed "s/-/_/g")
echo "Moving $f to $folder"
mv $f ~/BACKUP/$folder
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment