Created
November 8, 2020 03:46
-
-
Save lawrenceching/995c47b616a83acdbdba7635f66a4b67 to your computer and use it in GitHub Desktop.
Rename files
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
filter=*.out | |
from=.out | |
to=.zip | |
dryRun=false | |
for file in ./$filter | |
do | |
if [[ -f $file ]]; then | |
targetName=${file/$from/$to} | |
if [ $dryRun = true ]; then | |
echo "mv $file $targetName" | |
else | |
mv $file $targetName | |
echo "Changed $file to $targetName" | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment