Rename files using a regex with bash [duplicate]

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.

Leave a Comment