io » copyFilesByRegex(sourceDir,regex,target)
Description
This command copies all files matching the specified regex from one directory to other. This will always search files recursively and copy matched files to given target location.
Since the intended target file(s) could already exist, Nexial provides a few different options to handle such condition.
The System variable nexial.io.copyConfig
is created for this purpose.
One can define this System variable with one of the following values to alter how Nexial handle such situation:
keepOriginal
: don’t copy file (default behaviour)override
: override existing filebackup
: taking backup of existing file and copy new file
Parameters
- sourceDir : Full path of the directory to match files from.
- regex : Regex to match with the file.
- target : Full path of the destination file/directory.
Example
Script:
Output: