Overview
When copying, moving, renaming, and deleting files, or applying an XSL transformation, Etlworks uses the following rules to calculate the new (destination) file name:
Using global variables as a part of the destination file name
Any part of the destination file name can contain a global variable, enclosed in {}
. The system will replace the {token}
on the value of the global variable with the same name. Read about parameterization of file operations.
Empty TO field
If nothing is entered in the TO
field, the new file name will be similar to the source file name.
Regular expression replacement
If any part of the TO
field contains macros of this type: replace(regex, replacement)
, the system will perform a regular expression replacement of the enclosed part of the string and will concatenate it with the left and right parts of the string.
Example 1
FROM
: *_processing.xml
TO
: replace(_processing, _done)
If these are the source files in the source folder: order1_processing.xml
, order2_processing.xml
, and order3_processing.xml
,
then the following destination files will be created: order1_done.xml
, order2_done.xml
, and order3_done.xml
.
Example 2
FROM
: *_processing.xml
TO
: done/replace(_processing, _done)
If these are the source files in the source folder: order1_processing.xml
, order2_processing.xml
, and order3_processing.xml
,
then the following destination files will be created: done/order1_done.xml
, done/order2_done.xml
, and done/order3_done.xml
.
Example 3
FROM
: *.xml
TO
: replace('', _)
If these are the source files in the source folder: order1 processing.xml
, order2 processing.xml
, and order3 processing.xml
,
then the following destination files will be created: order1_processing.xml
, order2_processing.xml
, and order3_processing.xml
.
A non-wildcard file name is entered into the TO field
If a non-wildcard file name is entered into the TO
field, for example order.csv
, the new file name will be TO
+
optionally, _UUID
.
Example
FROM
: *.csv
TO
: order.csv
If these are the source files in the source folder: or1.csv
, or2.csv
, and or3.csv
,
then the following destination files will be created: order.csv
, order_uuid.csv
, and order_another_uuid.csv
.
A wildcard file name is entered into the TO field
If a wildcard file name is entered into the TO
field, for example *_processing.csv
, the new file name will depend on the position of the wildcard character *
in the TO
.
Example 1
The file name entered into the TO
starts with a wildcard character for base name:
FROM
: or*.csv
TO
: *_processing.csv
If these are the source files in the source folder: or1.csv
, or2.csv
, and or3.csv
,
then the following destination files will be created: or1_processing.csv
, or2_processing.csv
, and or3_processing.csv
.
Example 2
The file name entered into the TO
ends with a wildcard character for base name:
FROM
: or*.csv
TO
: order*.csv
If these are the source files in the source folder: or1.csv
, or2.csv
, and or3.csv
,
then the following destination files will be created: order1.csv
, order2.csv
, and order3.csv
.
Example 3
The file name entered into the TO
starts a wildcard character for base name and ends with a wildcard character for extension:
FROM
: or*.csv
TO
: *_processing.*
If these are the source files in the source folder: or1.txt
, or2.csv
, and or3.dat
,
then the following destination files will be created: or1_processing.txt
, or2_processing.csv
, and or3_processing.dat
.
Create files with unique names in file operations
The copy, move, rename, and zip file operations can create files with unique names by appending the configurable suffix. The following suffixes are available:
- timestamp: Timestamp in the format MMddyyyyhhmmss. For example, when the original filename is
patient.csv
: it becomespatient_03092017040523.csv
. - uuid: UUID - Globally Unique Identifier. For example, when the original filename is
patient.csv
: it becomespatient_f2f0fdb6-0132-11e7-93ae-92361f002671.csv
. - timestampdatefirst: Timestamp in the format ddMMyyyyHHmmss. For example, when the original filename is
patient.csv
: it becomespatient_09032017040523.csv
. - timestampyearfirst: Timestamp in the format yyyyMMddHHmmss. For example, when the original filename is
patient.csv
: it becomespatient_20170309040523.csv
. - timestampyeardatefirst: Timestamp in the format yyyyddDDHHmmss. For example, when the original filename is
patient.csv
: it becomespatient_20170903040523.csv
.
To add the suffix to the file name, select one of the available suffixes in the Add Suffix to the Destination File Name
field:
This parameter works only in file operations, such as copy and move. When creating the files using any source-to-destination transformation, use the technique explained here.
Automatic UUID suffix
If the system has already used a specific file name for the destination file when processing files by a wildcard, it will add _UUID
at the end of the file name.
order_758ced62472211e8842f0ed5f89f718b.csv
Comments
0 comments
Please sign in to leave a comment.