Skip to content

Instantly share code, notes, and snippets.

@pstorch
Created August 27, 2023 13:38
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 pstorch/800644b76969d5ffde3ad07620e104e1 to your computer and use it in GitHub Desktop.
Save pstorch/800644b76969d5ffde3ad07620e104e1 to your computer and use it in GitHub Desktop.
Move .jpg files to subdirectory by date
#!/bin/bash
for x in *.jpg; do
d=$(date -r "$x" +%Y-%m-%d)
mkdir -p "./$d"
mv -- "$x" "./$d/"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment