Page 1 of 1

Extract substring from filename

Posted: Wed Nov 06, 2013 9:25 am
by X-Ray
Hi,

is it possible to extract a substring (defined by regex or length) from the filename to "plot" it as text into the image?
I have files with names like
"1000x some words and numbers.jgp" or "250x some other words.jpg"
and want to extract the beginning number "1000" respectively "250" (the subsequent "x" may be included)

thanks in advance :wink:

Re: Extract substring from filename

Posted: Wed Nov 06, 2013 1:38 pm
by xnview
no sorry

Re: Extract substring from filename

Posted: Wed Nov 06, 2013 3:06 pm
by X-Ray
would be a nice feature :wink:

Re: Extract substring from filename

Posted: Wed Nov 06, 2013 6:00 pm
by cday
X-Ray wrote: ... is it possible to extract a substring (defined by regex or length) from the filename to "plot" it as text into the image?
It might be possible to do it using a batch file that first calls a command line file renaming utility and then calls NConvert, if the required substring can be extracted to a variable, which is then written to the image using NConvert's -text syntax.

One command line batch renaming utility:

http://www.bulkrenameutility.co.uk/Download.php -- Scroll down for the command line version.

Note that I haven't used it myself, and only suspect that it might be able to copy a string from a filename to a variable.