When copying, moving, renaming, deleting, or applying an XSL transformation to files, Etlworks calculates the destination filename using the rules below.
For destination filenames in source-to-destination transformations (a different code path), see File as a transformation destination.
Global variables in the TO field
Any part of TO can contain a global variable in {token} syntax. The token is replaced by the variable's value at runtime. Full details: parameterization of file operations.
Empty TO field
If TO is empty, the destination filename equals the source filename.
Regular-expression replacement — replace(regex, replacement)
Wrap any part of the TO field in replace(regex, replacement) and Etlworks runs a regex replace on the source filename, concatenating the result with the rest of TO.
Example 1 — substring replace:
- FROM = *_processing.xml
- TO = replace(_processing, _done)
Sources order1_processing.xml, order2_processing.xml, order3_processing.xml → order1_done.xml, order2_done.xml, order3_done.xml.
Example 2 — prepend a folder:
- FROM = *_processing.xml
- TO = done/replace(_processing, _done)
Sources → done/order1_done.xml, done/order2_done.xml, done/order3_done.xml.
Example 3 — replace spaces with underscores:
- FROM = *.xml
- TO = replace(' ', _)
Sources order1 processing.xml, order2 processing.xml, order3 processing.xml → order1_processing.xml, order2_processing.xml, order3_processing.xml.
Non-wildcard filename in TO
If TO is a literal filename (e.g. order.csv), the destination filename is TO, plus an optional UUID suffix if the same name was already used in this flow run.
Example. FROM = *.csv, TO = order.csv. Sources or1.csv, or2.csv, or3.csv → order.csv, order_uuid.csv, order_another_uuid.csv.
Wildcard filename in TO
If TO uses *, the position of the wildcard decides what part of the source filename it captures.
Example 1 — * at the start, replaces base name:
- FROM = or*.csv
- TO = *_processing.csv
Sources or1.csv, or2.csv, or3.csv → or1_processing.csv, or2_processing.csv, or3_processing.csv.
Example 2 — * in the middle:
- FROM = or*.csv
- TO = order*.csv
Sources or1.csv, or2.csv, or3.csv → order1.csv, order2.csv, order3.csv.
Example 3 — wildcards for both base name and extension:
- FROM = or*.csv
- TO = *_processing.*
Sources or1.txt, or2.csv, or3.dat → or1_processing.txt, or2_processing.csv, or3_processing.dat.
Create files with unique names in file operations
Copy, move, rename, and zip file operations can append a configurable suffix to every output filename. Pick a suffix type in Add Suffix to the Destination File Name:
| Suffix type | Format | Example (patient.csv becomes…) |
|---|---|---|
| timestamp | MMddyyyyhhmmss | patient_03092017040523.csv |
| uuid | Globally Unique Identifier | patient_f2f0fdb6-0132-11e7-93ae-92361f002671.csv |
| timestampdatefirst | ddMMyyyyHHmmss | patient_09032017040523.csv |
| timestampyearfirst | yyyyMMddHHmmss | patient_20170309040523.csv |
| timestampyeardatefirst | yyyyddMMHHmmss | patient_20170903040523.csv |
Note: This setting only applies to file operations. For unique names when creating files in source-to-destination transformations, use the equivalent setting on the transformation destination connection.
Automatic UUID suffix on collisions
When processing files by wildcard and the same destination filename has already been used in this flow run, Etlworks appends _UUID to the new filename automatically:
order_758ced62472211e8842f0ed5f89f718b.csv