Skip to content

Instantly share code, notes, and snippets.

@steffen-wirth
Created November 25, 2025 21:49
Show Gist options
  • Select an option

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

Select an option

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