Move Files

../../../../_images/move.svg

Move files to a destination specified in configuration or in the optional input port.

Documentation

The destination location can either be specified in the node’s configuration or by adding the optional File destination input port. When the File destination input port is used the destination is taken solely from that port and not from the configuration.

When specifying the destination directory in the configuration, you can leave it empty to use the directory of the source file as destination directory.

Missing directories will be created if needed.

Renaming files with a regex

Instead of specifying a static destination in the configuration, you can also specify a destination by enabling Use regex and writing a regex and replacement string.

For example with the regex ^folder_([0-9]+)/datafile.csv$ and replacement string datafile_.csv, the destination for a file at location folder_1234/datafile.csv would be datafile_1234.csv.

For more information about how to write regex, see Regular expression syntax.

Definition

Input ports

port1 [datasource]

File sources

port2 0 - 1, [datasource]

File destinations

Output ports

port1 [datasource]

File destination

Configuration

Directory (dest_folder)

Manually enter a directory

Do not raise exceptions (error)

If a file operation fails, do not raise an exception

Search (pattern)

Specify the regular expression that will be used for matching. Learn more about Regular expression syntax in the documentation appendix.

Replace (replace)

The string to replace the match found with the regular expression

Regex (use_regex)

Turn on/off naming using a regular expression

Examples

Implementation

class node_file_operations.MoveFiles[source]