Skip to content

Instantly share code, notes, and snippets.

@bsalex
Created July 23, 2014 20:45
Show Gist options
  • Save bsalex/e22c0e66da0f20214366 to your computer and use it in GitHub Desktop.
Save bsalex/e22c0e66da0f20214366 to your computer and use it in GitHub Desktop.
Console command to renames all files and subdirectories replaceing spaces with "_" in their names
find . -name "*\ *" -type f -exec sh -c 'mv "{}" "`echo \"{}\" | sed \"s/ /_/g\"`"' \; && find . -depth -name "*\ *" -type d -execdir sh -c 'mv "{}" "`echo "{}" | sed "s/ /_/g"`"' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment