ExifTool Forum

ExifTool => Newbies => Topic started by: Fulco on June 19, 2016, 06:29:07 AM

Title: Rename filename with regular expression
Post by: Fulco on June 19, 2016, 06:29:07 AM
How can I strip the first 4 characters, add a 6 digit substring and add a suffix at the same time?

All of the concerning filenames have the same format, for example: IMG-20160523-WA0006.jpg
The format I need is: 20160523140000-WA0006_received.jpg

I came not further than this:
exiftool '-TestName<${FileName;s/IMG-(\d{8})-([A-Za-z]+)(\d{4}).*/$1-$2$3_received/}.%e'

The regular expression will not match anymore if "140000" is added: 
exiftool '-TestName<${FileName;s/IMG-(\d{8})-([A-Za-z]+)(\d{4}).*/$1140000-$2$3_received/}.%e'

Is it possible to add this substring some way? Thanks in advance.

- Fulco
Title: Re: Rename filename with regular expression
Post by: StarGeek on June 19, 2016, 12:19:20 PM
Use ${1}140000 instead. 
Title: Re: Rename filename with regular expression
Post by: Fulco on June 19, 2016, 02:44:41 PM
Thank you! I really appreciate your help.

- Fulco