Frage

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.

War es hilfreich?

Lösung

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top