Renaming Files
The copy, Ftp, Sftp, decrypt tasks etc. have a rename field.
If
the rename field is filled, the rename is done using regular
expression.
You can use 3 different options to
rename:
Option 1: Filename field is used as the FIND
string.
First the filename field entry is compared against the
actual filename using regular expression Find method. If a match is
found, then the Filename field pattern entered is replaced with the
entry in the Rename Filename field.
Option
2:
Rename field specifies FIND string using <REPLACE>.
Rename
field
format:
find_string<REPLACE>replace_string
.txt.gpg<REPLACE>.txt
[0-9]<REPLACE>number
First
the filename field entry is compared against the actual filename
using regular expression Find method. If a match is found, then the
rename field is parsed and the 'find_string' is replaced with the
'rename_string'.
NOTE1:
find_string can be a regex pattern
NOTE2: Option 2
gives more flexibility. Here you can specify the filename filter to
find files in the filename field. Then, in the rename field, use
completely different 'find' and 'replace' strings.
Option
3:
Rename field specifies group regex pattern search/replace using
<GROUP>.
Rename field
format:
regex_(group)_pattern<GROUP>group_formatted_string
([0-9])<GROUP>group1.group2
(
) is the regex grouping pattern
The string group1
will
be replaced by the first group corresponding to the regex group
pattern.
The string group2
will
be replaced by the second group corresponding to the regex group
pattern.
Examples:
Option
1:
Actual Filenames in folder = Atest.txt.gpg ,
Btest.txt.gpg
Filename field entry = .txt.gpg
Rename field
entry = .txt
resulting filenames = Atest.txt & Btest.txt
i.e.
Both files pass the filename filter and will be processed.
Option
2:
Actual
Filenames in folder = Atest.txt.gpg , Btest.txt.gpg
Filename
field entry = Atest
rename field entry =
.txt.gpg<REPLACE>.txt
resulting filename = Atest.txt
Here
only Atest.txt.gpg passes the filename filter. Btest.txt.gpg is not
processed
Option
3:
Actual
Filename in folder = 9-5-7.txt
Filename field entry
= .txt
rename field entry =
([0-9])<GROUP>group3_group1.txt
resulting filename =
7_9.txt
here group1 = 9, group2 = 5, and group3 = 7 because of
the regex group pattern ([0-9])