Last active
July 20, 2017 03:10
-
-
Save KingPin/dfa1e84a21b85c657e53d04420f86273 to your computer and use it in GitHub Desktop.
remove 4 numbers from front and add to end of the file name, accounting for spaces, dashes, and adding the numbers in parentheses
This file contains 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 ./ -name '???? - *.xml' -print0 | while read -d ''; do | |
[[ $REPLY =~ (.*)/(....)\ -\ (.*)\.xml$ ]] || continue | |
path=${BASH_REMATCH[1]} | |
num=${BASH_REMATCH[2]} | |
str=${BASH_REMATCH[3]} | |
echo mv "$REPLY" "$path/$str ($num).xml" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment