Skip to content

Instantly share code, notes, and snippets.

@spuk-
Last active February 27, 2018 20:06
Show Gist options
  • Save spuk-/839e1298e7478e0e522b6837ad22ebb7 to your computer and use it in GitHub Desktop.
Save spuk-/839e1298e7478e0e522b6837ad22ebb7 to your computer and use it in GitHub Desktop.
Move files older than 2018-01-01 to a $year/$month subdirectory.
find . -maxdepth 2 -type f -not -newermt 2018-01-01 | while read q ; do d=$(date -r "$q" +`dirname "$q"`/%Y/%m); mkdir -p "$d"; mv -vi "$q" "$d"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment