To filesystem

To filesystem

The To filesystem workflow component is found as one of the basic output workflow components.

 

With this you can tell the workflow to output any kind of payload (contents of the workflow) into an output directory (file system).

 

If you e.g. previously created a PDF file, and then added a digital signature to it, then you can use this component to place the signed PDF file in the file system.

 

The component accepts any payload as input.

 

This component is unavailable, if file system access has been disabled in the system settings.

This component writes the current workflow body to a file on the local file system.

 

The parameters are these:

 

NG2WorkflowToFileSystem0001

 

Output directory

The path to the output directory where the file is to be stored. "{{env:INTERFORMNG2_HOME}}" can be used as part of the path, to denote the INTERFORMNG2_HOME directory. On the windows platform, that is (with default settings) inside C:\ProgramData\InterFormNG2\outbox. On the IBM i platform it is default: /iformng2/InterFormNG-shell/user/outbox. If folders in the specified path does not exist, then these folders will be created.

 

Output filename

What file name to use for the stored file.

 

File name conflict resolution

With this you specify what the workflow should do, if the file already exists. The options are:

Overwrite (default). If you select this, then any existing file with the same name will be overwritten by the new file.

Append version. Select this to add a counter (in parenthesis) at the end of the new file name - prior to the extension. Please read the warning below before using this option.

Rename existing. Rename the existing (old) file and add the timestamp to the file name. The old file will be rename similar to this: filename_20200812134611716.pdf.

Move existing. If you select this, then the original file will be moved to a subdirectory with the timestamp and the new file is created as requested.

 

With the file name conflict resolution you cannot be sure, what the output file was actually called, but you can get that information in the workflow after running this component, as the component updates the predefined variable, $interform.plugin.archiver.fileName with the actual correct name. This can e.g. be used, if you want to ensure, that an index file (created by the index data component) is named the same (except the extension) as the output PDF file, which is to be archived.

 

Not only can you select one of the fixed values above for the file name conflict resolution, but you can also use an XPath expression to set a variable value e.g. depending on the input file. The XPath expression should return one of these values:

 

Overwrite

Rename

AppendVersion

AppendTimestamp

 

Unknown values will result in "Overwrite" being used.

 

The following values are also accepted (InterFormNG related values), BUT will result in a warning

append-version-number

rename-existing-file

overwrite-existing-file

 

 

Warning regarding append version for file name conflict

Here is an important note/warning when it comes to use of the option: Append version for the file name conflict resolution. You should consider this option as the last resort to ensure a unique file name i.e. it is e.g. very bad practice to simply store MANY files with a fixed name in a folder and then expect InterFormNG2 to rename the output files automatically with the append version option.

 

If you choose to e.g. save 100.000 files in this manner, then each new file that is created will run through the existing 100.000 files with the same name (and a number at the end) until finally a free number has been found, which will take up a lot of unnecessary time. So it is best practice to try the best to ensure that the append version option is only triggered in a very unlikely situation. InterFormNG2 contains multiple functions, that can help you to build a dynamic, unique file name. You can consider to concat a fixed part of the file name with e.g. the timestamp, contents from the file or the UUID and either only use these or even combine them with a fixed part like the examples below:

 

NG2WorkflowToFilesystem0002

 

NG2WorkflowToFilesystem0003

 

    • Related Articles

    • List filesystem directory

      You can use InterFormNG2 to generate a list of all files in a specific directory (and even include files in sub-directories) and output the list as an XML file. This can be done with the advanced, utilities workflow component called: List filesystem ...
    • Basic output components

      The basic output workflow components are: 1.To filesystem 2.To FTP 3.To sub-workflow
    • Render email HTML

      The workflow component, Render email HTML (which is an advanced create document workflow component) accepts XML as input and generates an HTML file, that e.g. can be saved into the file system with the to filesystem component. The Render email HTML ...
    • EML

      EML is one of the file types/payloads, that can be handled by the InterFormNG2 workflow. Eml is the format in which an email can be saved. This is used internally in InterFormNG2, but you can also create an email and save it in the EML format with ...
    • Create EML with PDF

      The create document, workflow component, Create EML with PDF is the same as the Create PDF email component with two major differences: The Create PDF email component sends out an email. The Create EML with PDF document creates an EML file in the ...