Skip to content

Instantly share code, notes, and snippets.

@alexec
Created January 31, 2016 11:43
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 alexec/95e92ab2dcd12441650e to your computer and use it in GitHub Desktop.
Save alexec/95e92ab2dcd12441650e to your computer and use it in GitHub Desktop.
#! /bin/bash
set -eu
find . -mindepth 1 -maxdepth 1 -name '*.jpg' -or -name '*.JPG' | while read F ; do
echo $F
D=$(stat -f '%Sm' -t '%Y/%m/%d' "$F")
if [ ! -e $D ]; then
mkdir -p $D
fi
mv -v "$F" $D/
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment