How do I rename a bulk of files in a bash command or script, to remove iOS's retina indicator (@2x)?
I've already resized them, but the resize software isn't smart on renaming the output file.
Bash offers substitution using the ${var/}
syntax. Example: ${i/AAAA/BBBB}
replaces AAAA
occurrences in $i
with BBBB
. Therefore loop over all files matching *@2x.*
and rename each one.
for i in *@2x.*; do
mv "$i" "${i/@2x/}"
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With