Created
April 25, 2014 16:17
-
-
Save isayev/11294997 to your computer and use it in GitHub Desktop.
Shell script to rename files with brackets & white space to underscores
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -depth -name '*(*' | while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr '(' _)" ; done | |
find . -depth -name '*)*' | while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ')' _)" ; done | |
find . -depth -name '* *' | while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment