Skip to content

Instantly share code, notes, and snippets.

@webbedfeet
Created April 19, 2018 01:30
Show Gist options
  • Save webbedfeet/8d8fb8d764aafc3fdfe89817ba7d043d to your computer and use it in GitHub Desktop.
Save webbedfeet/8d8fb8d764aafc3fdfe89817ba7d043d to your computer and use it in GitHub Desktop.
Replace spaces in filenames/directories recursively
find . -name "* *" -print0 | sort -rz | \
while read -d $'\0' f; do mv -v "$f" "$(dirname "$f")/$(basename "${f// /_}")"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment