looking for help in renaming a file--inserting a "_" in the middle

Started by jma, March 05, 2020, 06:14:05 AM

Previous topic - Next topic

jma

I am now looking to insert a "_" four characters from the left (or right) end of the file. 

Not being too familiar with the Renamer tool (yet), I'm wondering if someone could advise me as to the syntax I should use to change a file that currently looks like this "filename.jpg" but that I would like to make look more like this:  "file_name.jpg"

Many thanks.  --John

Mario

You can achieve that with the Renamer using a simple text step with variables.
The variables allow you to 'snip' out the parts of the file name you want and to insert the _ where you want.

Create a Renamer preset which uses a "Text and Variables" step.
This step has these variables:

{File.NameExt|substr:0,4}_{File.NameExt|substr:4}

The first variable extracts the first 4 characters from the file name. Then follows a _ and the 2nd variable extracts everything after the first four characters.

A file name like _DSC12345.jpg is renamed to _DSC_12345.jpg

To do the same from the back, you would use substrr instead.

See Variable Formatting Functions in the IMatch help for more information.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

jma

Your suggestion works like a charm, Mario. Thanks! 
--John