Rename filename based on contents - file renaming lis

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Rename filename based on contents - file renaming lis

Post 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
Post Reply