I am also looking for the same script to append the file name. I am getting API response and need to add yyyyMMddHHmmssff in the file name while archiving into Azure blob.
Original file name: 990Response_Input.xml
Expected file name: 990Response_Input_2023082913210100.xml
I found a way, but actually depends on the connector used (I did not realize before, sorry)
I am using AS2 connector and there is an option to define a mask for saving, using wildcards
it is very easy
%FilenameNoExt%-%AS2MessageId%%EXT%
Is it also possible to add additional text to the filename, for example the name of a company, which isn't defined in one of the macro's?
<!-- Adding datetime to output Filename using script connector→
<arc:set attr="output.filepath" value="=filepath]" />
<arc:set attr="output.filename" value="=filename | replace('.xml',_,now('yyyyMMddHHmmssff')])].xml"/>
<arc:push item="output" />
Just to be sure, let's say I want a file to be renamed from 990Response_Input.xml to Company-990Response_Input.xml, but the "Company-” name is not the name of a Connector.
How can I add the text "Company-” in front of the current filename, as I can't use the replace formatter?
Hi Richard, Bvbert,
It seems to me that you are both using CData Arc, and if that is the case, every connector has a field in the Advanced tab called Local File Scheme - this field can be used to rename the output file from it’s original format into a new pattern, using macros to dynamically resolve the original filename or values such as a timestamp.
@RichardG - to prefix your AS2 file with a static string, you’d simply set the Local File Scheme to this:
Company-%Filename%
@bvbert1969 - to append a timestamp regardless of the original filename, you can use a combination of macros:
%FilenameNoExt%-%DateFormat:yyyyMMddHHmms%%Ext%