Skip to content

Instantly share code, notes, and snippets.

@steffen-wirth
Created November 26, 2025 16:24
Show Gist options
  • Select an option

  • Save steffen-wirth/0aab04ab842edf1c1e4c0f6f7979c066 to your computer and use it in GitHub Desktop.

Select an option

Save steffen-wirth/0aab04ab842edf1c1e4c0f6f7979c066 to your computer and use it in GitHub Desktop.
# copy files into folders
find . -type f -exec bash -c 'mkdir -p "${1%/*}/$(date -r "$1" "+%Y")"; cp "$1" "${1%/*}/$(date -r "$1" "+%Y")/"' _ {} \;
#move files into folders
find . -type f -exec bash -c 'mkdir -p "${1%/*}/$(date -r "$1" "+%Y")"; mv "$1" "${1%/*}/$(date -r "$1" "+%Y")/"' _ {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment