Possible Duplicate:
rename multiple files at once in unix
I would like to rename all files from a folder using a regex (add a name to the end of name) and move to another folder.
It my opinion, it should be looking like this:
mv -v ./images/*.png ./test/*test.png
but it does not work.
Can anyone suggest me a solution?
To rename a file in bash we use mv command: -v : Verbose option. In other words, display the progress of the files as they are being moved or renamed in a bash shell.
If you want to rename multiple files when you copy them, the easiest way is to write a script to do it. Then edit mycp.sh with your preferred text editor and change newfile on each cp command line to whatever you want to rename that copied file to.
If you are on a linux, check special rename
command which would do just that - renaming using regular expressions.
rename 's/^images\/(.+)/test\/$1.png/s' images/*.png
Otherwise, write a bash cycle over the filenames as catwalk suggested.
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