Post #3992796
2026-07-21 18:30 UTC
Two ways:
Say you want to rename the files Sevilla_big{number}.jpg to Sevilla_small{number}.jpg:
in bash, using the extglob option:
shopt -s extglob
for f in pics/**/Sevilla_big*.jpg
do
mv $f ${f/big/small}
done
Using find:
find . -name ‘Sevilla.*big.jpg’ > t
now, you edit the file with Emacs or vim so that you duplicate the file names, modify them as you want, and copy them using the copy-rectangle command right to the collumn with the original names. Delete any names of files you don’t want to change. save the result to t.
Then, in bash:
<t while read a b; do mv $a $b; done
(You could also insert the mv command as a furst collumn in t, save t and do:
source t
Bonus option:
Use the mmv command
Replies (0)
No replies.