Last active
April 27, 2019 22:28
-
-
Save keithchambers/26be42045b701d4ffe5b49af825739fb to your computer and use it in GitHub Desktop.
rename-dirs.sh
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
#!/bin/bash | |
IFS=$'\n' | |
FOLDERS=$(find ./ -type d | grep _\(WAVs\)_) | |
for FOLDER in ${FOLDERS}; do | |
MV_FOLDER=${FOLDER//_\(WAVs\)_} | |
MV_FOLDER=${MV_FOLDER//_/ } | |
echo "mv ${FOLDER} ${MV_FOLDER} " | |
mv ${FOLDER} ${MV_FOLDER} && echo "SUCCESS" || echo "FAILED" | |
done | |
# EOF |
#!/bin/bash
IFS=$'\n'
FOLDERS=$(find ./ -type d | grep " (WAVs"))
for FOLDER in ${FOLDERS}; do
MV_FOLDER=${FOLDER// (WAVs) }
echo "mv ${FOLDER} ${MV_FOLDER}"
mv ${FOLDER} ${MV_FOLDER} && echo "SUCCESS" || echo "FAILED"
done
EOF
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
find . -depth -name "_" -exec
sh -cf '
for f do IFS=_
IFS=\ set "${f%/}/"${f##/}$0
mv "$f" "$*"
done
' _ {} +