Edit Path Variable Filename

Allows on-the-fly editing of an input path and file name using string concatenation (additon of simple prefix or suffix to a filename) or replacement of filename using regex, and direct replacement of filename extension.

Also allows the folder path to be modified using regex replacement.

Where regex is used, it follows the regex required by the String Manipulation regexReplace function, so any use of a \ within a folder path must be entered as double-backslash \\ so that regex does not misinterpret the character.

Example replacement that could be performed:

For an incoming file path representing

c:\myoutputfolders\excel\somefile.xlsx

Setting:
prefix: accounts-
suffix: -formatted
regex file search: (.*)file
regex file replace $1sheet
regex folder search: (.*)\\myoutputfolders\\(.*)
regex folder replace: $1\\formattedoutputs\\$2

would result in the output file:
c:\formattedoutputs\excel\accounts-somesheet-formatted.xlsx


@takbb Brian Bates 09 October 2022

Update v2 13 November 2022 - now resolves workflow and workflow data relative paths to absolute paths

Options

Create additional STRING Variable containing new path (absolute path)
Select this option to also create a String Variable containing the new path, in addition to the path variable. It will be given the same name as the Path variable but with the addition of -str suffix
Choose source path variable
Choose the path variable that contains the file name that you wish to edit
Replacement Extension (e.g. csv, xlsx, json) Do not include the "."
Enter the new extension for the file (or leave blank to keep existing)
New Filename prefix
Enter a prefix to add to the start of the file name (or leave blank)
New Filename Suffix
Enter a suffix to add to the end of the file name (or leave blank)%%00010
Enter regex pattern to replace
Enter a regex pattern to replace in the file name (does not include folder path or extension).%%00010%%00010default of ^(.*?)$ is used to select entire name
Enter replacement string (can include regex capture groups)
Enter the string value to use in replacing the specified file name string. You can use $1, $2 etc as regex capture groups
Path variable name to create (leave blank to replace source variable)
Enter a name for the new path variable
Folder regex pattern to replace. Use \\ in place of \
Enter a regex pattern to replace in the folder. For backslashes in folder names use double-backslash \\%%00010%%00010default of ^(.*?)$ is used to select entire name
Folder replacement string (can include regex capture groups). Use \\ instead of \
Enter the string value to use in replacing the specified folder name string. You can use $1, $2 etc as regex capture group

Input Ports

Icon
No description for this port available.

Output Ports

Icon
No description for this port available.

Nodes

Extensions

Links