Created
April 12, 2022 00:14
-
-
Save discarn8/ff1a573b007636dc14c93a85c952036d to your computer and use it in GitHub Desktop.
RenameCharacter
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='' | |
echo -n "Enter character to remove: " | |
read -r rename | |
while true; do | |
read -p "The character to remove is \""${rename}"\" - Is this correct? " yn | |
case $yn in | |
[Yy]* ) for i in *; do | |
if [[ "$i" == *"_"* ]];then | |
echo "Found a file...."; | |
sleep 2; | |
echo "Renaming $i"; | |
mv -i "$i" "`echo "$i" | sed \"s/$rename/ /g\"`"; | |
#mv "$i" "`echo $i | sed "s/_/ /g"`"; | |
fi; | |
done; | |
break;; | |
[Nn]* ) exit;; | |
* ) echo "Please answer yes or no.";; | |
esac | |
done | |
echo "Renaming done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment