SafeFilenameCreator
Description
The SafeFilenameCreator transformer ensures that attribute values are converted into safe filenames by replacing all illegal characters with an underscore (_).
It works by internally using a StringReplacer to sanitize the attribute values.
Parameters
Attributes to Replace (String, Required): The name of the attribute(s) whose values will be converted into a safe filename.
Behavior
Takes the value of the specified attribute.
Replaces all characters that are not allowed in filenames (such as \/:*?"<>|) with _.
Outputs the sanitized string as the same attribute value or a new attribute (depending on configuration).
Example Usage
Input Attribute
- Name: Filename
- Value: My:Illegal/FileName?.txt
Output Attribute
- Name: Filename
- Value: My_Illegal_FileName_.txt
Notes
Only affects the characters that are illegal in filenames.
Can be combined with other transformers to build fully automated file export workflows.
Tips
Use this transformer before writing files to disk to prevent errors due to invalid filenames.
Can be chained with an AttributeCreator to generate new safe filename attributes without overwriting the original.
Would you like to know more? Click here to find out more details!