Name
<< Click to Display Table of Contents >> Navigation: Robo-FTP User's Guide > Robo-FTP Framework > Job Definitions > Built In Steps > Name |
Note: First see Working with File Sets for a discussion on how data flows through step to step.
The Name step performs a file name search and replace using perl regular expressions.
Friendly Name |
INI Variable |
Required? |
Description |
File Filter |
specification |
optional |
which file(s) to rename |
Search Pattern |
pattern |
required |
regex search string |
Replace Pattern |
replace |
required |
regex replacement string |
Note: Only files in the current file set are renamed unless the specification includes full folder paths.
Example Usage:
Working with subdirectories
When dealing with files under subdirectories, the search and replace patterns can be used to directly modify the directory structure. To do so, include a \\ (literal backslash character) in your search pattern. For example, suppose you unzip a file and it has subdirectories in it. There are now subdirectories in the file set. You might want to:
(1) flatten the files and place them all under one subdirectory:
file filter: *
search pattern: ^.*\\(.*)$
replace pattern "one_subdirectory\\${1}"
(2) place all files that match a certain extension under a particular subdirectory, no matter which nested subdirectory they originally were in:
file filter: *csv
search pattern: ^.*\\(.*)$
replace pattern "all_csvs_go_here\\${1}"
(3) or place all files found in one specific subdirectory into a different subdirectory:
file filter: *pdf
search pattern: \\old_dir\\(.*)$
replace pattern "\\new_dir\\${1}"