Page 1 of 1

how to batch rename the filename?

Posted: 2012/05/18 03:19:57
by zjhxmjl
How to batch rename the file name suffix with 'png'? the file name eg:A001.attach,A002.attach~A030.attach

how to batch rename the filename?

Posted: 2012/05/18 04:07:22
by AlanBartlett
[code]
[b]for A in *.attach; do B=$(echo $A | sed 's/attach$/png/'); mv $A $B; done[/b]
[/code]
That will replace the "attach" suffix of every file with a "png" suffix.

If you would like to append a dot "png" suffix to every file, a simpler "for do done" construction can be used --

[code]
[b]for C in *.attach; do mv $C $C.png; done[/b]
[/code]

Re: how to batch rename the filename?

Posted: 2012/05/18 15:45:30
by TrevorH
Or..

[code]
$ rpm -qf `which rename`
util-linux-2.13-0.59.el5.x86_64
$ rename .attach .png *.attach
[/code]

Re: how to batch rename the filename?

Posted: 2012/05/18 23:55:33
by zjhxmjl
Thank you very much!

Re: how to batch rename the filename?

Posted: 2016/05/11 19:29:32
by shanemario
How would i batch rename and change the number sequennce of a tiff sequence... ie

ThePicture_UHD_24p_98789976.tiff
ThePicture_UHD_24p_98789977.tiff
...

change that to
ThePicture_UHD_24p_98700000.tiff
ThePicture_UHD_24p_98700001.tiff
...

thanks!!