Skip to content

Instantly share code, notes, and snippets.

@JoseHdez2
Created November 25, 2019 09:48
Show Gist options
  • Save JoseHdez2/f10d78a18121fe5c105e9f01d72321ee to your computer and use it in GitHub Desktop.
Save JoseHdez2/f10d78a18121fe5c105e9f01d72321ee to your computer and use it in GitHub Desktop.
Sort files in current directory into folders by date (YYYY-MM-DD)
#!/bin/bash
for x in *.*; 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