Skip to content

Instantly share code, notes, and snippets.

@lawrenceching
Created November 8, 2020 03:46
Show Gist options
  • Save lawrenceching/995c47b616a83acdbdba7635f66a4b67 to your computer and use it in GitHub Desktop.
Save lawrenceching/995c47b616a83acdbdba7635f66a4b67 to your computer and use it in GitHub Desktop.
Rename files
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