Back to FabImage Studio website

You are here: Start » Filter Reference » System » File System » GenerateFileName

GenerateFileName


Module: FoundationLite

Generates consecutive file names, e.g. for saving series of images

Name Type Description
Input value inDirectory Directory Input directory
Input value inPattern String File name pattern, $ is replaced by date, # is replaced by number
Output value outFile File Generated file name

Description

Working with GenerateFileName

Start with defining input directory in inDirectory, where the files will be stored. Then, define the pattern of file names. It should contain:

  • '#' signs, which will be replaced with number of image (required). Files are enumerated from 0.
  • '$' signs, which will be replaced with current date in form of YYYY_MM_DD_hh_mm_ss (optional).

Examples

Examples of patterns and resulting file names are shown in the table below:

Pattern
Resulting file name
Explanation
file_$_####.txt file_2017_12_15_09_44_03_0000.txt 2017_12_15_09_44_03 is the date and time of the generation of the file name. The last number - 0000 - indicates, that the name is generated for the first file in the sequence.
file####.txt file0021.txt The number 0021 indicates, that the name is generated for the 22nd file in the sequence.
$_##.txt 2017_12_15_09_44_03_01.txt 2017_12_15_09_44_03 is the date and time of the generation of the file name. The last number - 01 - indicates, that the name is generated for the second file in the sequence.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Exactly one series of # characters is required in pattern in GenerateFileName.
DomainError Given directory does not exist in GenerateFileName.

Complexity Level

This filter is available on Advanced Complexity Level.

See Also

  • FileAttributes – Provides information about file, e.g. size, modification time