Mac batch rename files (add prefix and suffix)

For example,
I want to rename name.PNG to pre_name.PNG
PNG format file with prefix "pre_"
for i in *.PNG;do mv "$i" "pre_${i%.PNG}.PNG" ;done
and PNG format file with suffix "_tail"
for i in *.PNG;do mv "$i" "${i%.PNG}_tail.PNG" ;done
in the same way as name_Mon.jpg to name_Sun.jpg (right click to rename):
for i in *.jpg;do mv "$i" "${i%_Mon.jpg}_Sun.jpg" ;done

Guess you like

Origin blog.csdn.net/m0_46728513/article/details/128036275