Create File with Incrementing Suffix
- Updated2023-02-17
- 5 minute(s) read
Create File with Incrementing Suffix
Creates a file and appends an incrementing number suffix to the filename if the file already exists at a specified path. If the file does not exist, this node creates the file without appending an incrementing number suffix to the filename.
Inputs/Outputs

format string
A string that uses format specifiers to determine how to convert the data into what you specify.
Default value: %d
Syntax Elements for Creating a Format Specifier
Use the following syntax elements to create a format specifier for the input string.
| Syntax Element | Description |
|---|---|
| % | Syntax element that begins the format specifier. |
| $ (optional) | Modifier that specifies the order in which to display variables when used within a formatting node. Include the digit that represents the order of the variable immediately before this modifier. |
| - (optional) | Modifier that justifies the parameter to the left, within its width, when used within a formatting node. |
| + (optional) | Modifier that includes mathematical symbols when used within a formatting node.
Note The mathematical symbols appear even when the number is positive.
|
| ^ (optional) | Modifier that formats the number in engineering notation, where the exponent is always a multiple of three.
Note This modifier must be used within a formatting node that has either an
e or
g conversion code in the format specifier.
|
| # (optional) | Modifier that removes trailing zeros when used within a formatting node. If the number has no fractional part, this modifier also removes the description part. |
| 0 (optional) | Modifier that pads any excess space to the left of a numeric parameter with zeros, rather than spaces, to reach a minimum width when used within a formatting node.
Note Using the
- modifier with
0 nullifies the effect.
|
| Width (optional) | Syntax element that specifies an exact field width to use. When used within a formatting node, the
Width element specifies the minimum character field with of the output. The field is padded to the left or right of the parameter with spaces, depending on justification.
Note As many characters as necessary are used to format the parameter without truncating it.
|
| .Precision or _Significant Digits (optional) | Syntax element that controls the number of digits displayed when used within a formatting node.
Note You cannot use precision and significant digits together in a single format specifier.
|
| {Unit} (optional) | Syntax element that overrides the original unit of a VI when you use a node to convert a physical quantity. |
| <Embedded Time Format> (optional) | Contains a time-specific format string for use with the
T (absolute time) and the
t (relative time) conversion codes.
Note Only
%W,
%D,
%H,
%M,
%S, and
%u apply to relative time.
|
| Conversion Codes | Characters that specify how to scan or format a parameter.
|
| Localization Codes | Characters that determine whether to use a decimal or a comma to separate the whole number from the decimal part of the number.
|
| Backslash (\) Codes | Characters that specify hex values, spacing, backspaces, and other formatting options. |
Format Specifier Examples for Format String
| format string | file path | actual path | Comments |
|---|---|---|---|
| %d | C:\test.txt | C:\test (1).txt | The
%d in format string specifies that the node appends an incrementing number starting with 1 to the filename before the period (.).
Note There is a space at the beginning of the format string.
|
| %4d | C:\test.txt | C:\test 1.txt | The 4 in format string specifies that the suffix after the filename and before the period (.) has a width of 4. |

file
Absolute path to the file you want to create. If you specify an empty or relative path, this node returns an error.

error in
Error conditions that occur before this node runs.
The node responds to this input according to standard error behavior.
Default value: No error

disable buffering
A Boolean that specifies whether the file opens without buffering, which, for large amounts of data, may increase the rate of data transfer to the file.
| True | The file opens without buffering. |
| False | The file opens with buffering. |
Default value: False

reference
A reference to the file this node creates.

actual path
Path to the file this node creates.

error out
The node produces this output according to standard error behavior.
This node can return the following error codes.
| 1430 | The path is empty or relative. You must use an absolute path. |