Page 1 of 1

Rename filename based on contents - file renaming lis

Posted: Thu Feb 20, 2014 10:39 am
by DataMystic Support
Because the output filename is set before the file contents are processed, you can't use a Restrict\Restrict to filename filter to extract the file contents and shove them into the filename.

What you need to do is combine data extracted from the file, with the current filename macro @inputfilename@ or @fullinputfilename@, and manipulate this with 1 or more search/replaces into a CMD.EXE file renaming batch file, in the form of

Code: Select all

ren "original filename" "new filename"
ren "original filename" "new filename"
etc in a .BAT file, set as the output filename of the Output Filter - otherwise you end up overwriting your input file - yikes!

Code: Select all

|--Input from file(s)
|   
|--EasyPattern [date: [capture(2 digits) as 'month','-',capture(2 digits) as 'day','-',capture(2 digits) as 'year']] with [ren "@fullinputfilename@" "@year@-@month@-@day@.txt"\r\n]
|     [X] Extract matches
|
+--Merge output to file rename_files.bat