Skip to main content

File Plugin API

This plugin implements functions used for file handling.

The FilePlugin use cases.

Actions

Read about actions.

FileRead

Reading Data from File into Specified Parameter parameter.

Parameters:

Path : String *

The file path.

Parameter name : String *

The name of parameter, to store the file contents after reading.

Parameter purpose : ParameterPurpose *

ParameterPurpose defines the behavior for saving the parameter.

Parameter type : ParameterType *

Specifies the type for saving.

File mode : FileMode *

Specifies how the operating system should open the file.

File access : FileAccess *

Defines constants for read, write, or read/write access to the file.

File share : FileShare *

Contains constants for controlling the kind of access that other FileStream objects can have to the same file.

Buffer size : Int32 *

Defines the buffer size when reading the data.

Default value: 4096

FileWrite

Writing to File.

Parameters:

Path : String *

The file path.

Text : String *

The text to be written to the file.

File mode : FileMode *

Specifies how the operating system should open the file.

File access : FileAccess *

Defines constants for read, write, or read/write access to the file.

File share : FileShare *

Contains constants for controlling the kind of access that other FileStream objects can have to the same file.

FileDelete

Deleting File with Specified Path.

Parameters:

Path : String *

The path to the file that should be deleted.

FileDownload

Downloading File with Given Address to Computer Using Selected protocol.

Parameters:

Protocol : Protocol *

Sets the protocol to be used when downloading files.

Default value: FTP

User name : String

The user name to be used in NetworkCredential when creating a request.

Password : String

The password to be used in NetworkCredential when creating a request.

Port : Int32

An int32 greater than zero that contains the port to be used on host.

If not set, it will be set automatically.

URL : String

The URL the request is sent to. Applied for HTTP/HTTPS protocols.

Host : String

Only for FTP/FTPS protocols. The server address where the request is sent to.

Remote path : String

Only for FTP/FTPS protocols. The file path on the server.

Local path : String *

The file path on the computer for downloading.

FileUpload

Uploading File from Computer to Given Address Using Specified protocol.

Parameters:

Protocol : Protocol *

Sets the protocol to be used when uploading files.

User name : String

The user name to be used in NetworkCredential when creating a request.

Password : String

The password to be used in NetworkCredential when creating a request.

Port : Int32

An int32 greater than zero that contains the port to be used on host.

If not set, it will be set automatically.

Host : String *

The server address the request is sent to.

Remote path : String *

The file path on the server.

Local path : String *

The file path on the computer for uploading.

FileMove

Moving File.

Parameters:

Path : String *

The file path.

Path for move : String *

The path for moving (including the name and the extension).

FileCopy

Copying File with Specified Path.

Parameters:

Path : String *

The file path.

Path for copy : String *

The path for copying (including the name and the extension).

FileRename

Renaming File.

Parameters:

Path : String *

The file path.

New path : String *

The path for renaming (including the name and the extension).

FilesListRead

Reading List of Files into One or Several parameter.

Parameters:

Files list read : String *

The list of files whose contents to be copied into the specified parameters.

Example: file path 1 => parameter name 1; file path 2, file path 3, file path 4 => parameter name 2.

The contents of the file «file path 1» is copied to the parameter «parameter name 1».

The contents of the files «file path 2», «file path 3», «file path 4» is copied to the parameter «parameter name 2».

Tha data are written into parameter as a dictionary:

// synchronous operations with parameter
var data1 = processInstance
.GetParameter<Dictionary<string, string>("parameter name 1");

// asynchronous operations with parameter
var data2 = await processInstance
.GetParameterAsync<Dictionary<string, string>("parameter name 2")
.ConfigureAwait(false);

Parameter purpose : ParameterPurpose *

ParameterPurpose defines the behavior for saving the parameter.

Identify by full name : Boolean *

The flag for the file name: if true, the full file name is used as the key in the dictionary; if false, the file name without the extension is used as the key in the dictionary.

Adding files with the same name to the dictionary will throw an exception.

Default value: true

Parameter type : ParameterType *

Sets the type to read into.

List files mode : FileMode *

Specifies how the operating system should open the files.

List files access : FileAccess *

Defines constants for read, write, or read/write access to the files.

List files share : FileShare *

Contains constants for controlling the kind of access that other FileStream objects can have to the same file.

Buffer size : Int32 *

The buffer size when reading the data.

Default value: 4096

FilesListDelete

Deleting List of Files.

Parameters:

Files list delete : String *

The list of files for deleting, comma separated.

Example: file path 1, file path 2.

The files «file path 1», «file path 2» will be deleted.

FilesListMove

Moving List of Files.

Parameters:

Files list move : String *

The list of file paths and new file paths.

Example: file path 1 => path for move 1, file path 2 => path for move 2.

The file «file path 1» will be moved to «path for move 1», the file «file path 2» will be moved to «path for move 2».

FilesListCopy

Copying List of Files.

Parameters:

Files list copy : String *

The list of file paths and the paths for copying.

Example: file path 1 => path for copy 1, filePath2 => path for copy 2.

The file «file path 1» will be copied to «path for copy 1», the file «file path 2» will be copied to «path for copy 2».

FilesListRename

Renaming List of Files.

Parameters:

Files list rename : String *

The list of file paths and the paths with new names.

Example: file path 1 => file new path 1, file path 2 => file new path 2.

The file «file path 1» will be renamed and moved to «file new path», the file «file path 2» will be renamed and moved to «file new path 2».

DirectoryCreate

Creating Directory.

Parameters:

Path : String *

The path for the directory to be created.

DirectoryDelete

Deleting Directory.

Parameters:

Path : String *

The path for the directory to be deleted.

With files and subdirectories

The flag for deleting files and subdirectories:

  • true - the directory will be deleted with the nested items.
  • false - if the directory contains any nested items, it won't be deleted.

DirectoryMove

Moves Directory to another location.

Parameters:

Path : String *

The path to the directory to be moved.

New path : String *

The new path to the directory.

DirectoryDownload

Downloading Directory from Given Address to Computer Using Specified protocol.

Parameters:

Protocol : Protocol *

Sets the protocol to be used when downloading files.

User name : String

The user name to be used in NetworkCredential when creating a request.

Password : String

The password to be used in NetworkCredential when creating a request.

Port : Int32

An int32 greater than zero that contains the port to be used on host.

If not set, it will be set automatically.

Host : String *

The server address the request is sent to.

Remote path : String *

The directory path on the server.

Local path : String *

The directory path on the computer for downloading.

DirectoryUpload

Uploading Directory from Computer to Given Address Using Specified protocol.

Parameters:

Protocol : Protocol *

Sets the protocol to be used when uploading files.

User name : String

The user name to be used in NetworkCredential when creating a request.

Password : String

The password to be used in NetworkCredential when creating a request.

Port : Int32

An int32 greater than zero that contains the port to be used on host.

If not set, it will be set automatically.

Host : String *

The server address the request is sent to.

Remote path : String *

The directory path on the server.

Local path : String *

The directory path on the computer for uploading.

DirectoryCopy

Copying Directory.

Parameters:

Path : String *

The path to the directory to be copied.

Copy path : String *

The new path to the directory.

Sub directory : Boolean *

The flag for copying nested subdirectories: if true, the nested subdirectories will be also copied; if false, the nested subdirectories won't be copied.

Default value: true

Mask sub directories : String *

Mask for subdirectories. Only those subdirectories that meet the mask will be copied. Read about masks.

Default value: *

Mask files : String *

Mask for files. Only those files that meet the mask will be copied. Read about masks.

Default value: *

DirectoryRename

Renaming Directory.

Parameters:

Path : String *

The path to the directory.

New path : String *

The path with the new name.

DirectoryGetFiles

Getting List of Files in Given Directory into Specified parameter.

Parameters:

Directory get files : String *

The list of directories, the list of files to be stored in the specified parameters.

Example: path 1 => parameter name 1; path 2, path 3, path 4 => parameter name 2.

The files of the directory «path 1» will be stored in the parameter «parameter name 1».

The files of the directories «path 2», «path 3», «path 4» will be stored in the parameter «parameter name 2».

The data are written in the parameter as a dictionary:

// synchronous operations with parameter
var data1 = processInstance
.GetParameter<Dictionary<string, string>("parameter name 1");

// asynchronous operations with parameter
var data2 = await processInstance
.GetParameterAsync<Dictionary<string, string>("parameter name 2")
.ConfigureAwait(false);

Parameter purpose : ParameterPurpose *

ParameterPurpose defines the behavior for saving the parameter.

Identify by full name : Boolean *

The flag for the file name: if true, the full file name is used as the key in the dictionary; if false, the file name without the extension is used as the key in the dictionary.

Default value: true

Adding files with the same name to the dictionary will throw an exception.

Sub directory : Boolean *

The flag for adding nested subdirectories: if true, the nested subdirectories will be also added; if false, the nested subdirectories won't be added.

Mask sub directories : String *

Mask for subdirectories. Only those subdirectories that meet the mask will be added. Read about masks.

Default value: *

Mask files : String *

Mask for files. Only those files that meet the mask will be added. Read about masks.

Default value: *

DirectoryGetDirectories

Getting List of Nested Directories.

Parameters:

Directory get directories - the list of the nested directories to be stored in the specified parameter.

Example: path 1 => parameter name 1; path 2, path 3, path 4 => parameter name 2.

The nested directories for the directory «path 1» will be stored in parameter «parameter name 1».

The nested directories fo the directories «path 2», «path 3», «path 4» will be stored in parameter «parameter name 2».

The data are written in the parameter as a dictionary:

// synchronous operations with parameter
var data1 = processInstance
.GetParameter<Dictionary<string, string>("parameter name 1");

// asynchronous operations with parameter
var data2 = await processInstance
.GetParameterAsync<Dictionary<string, string>("parameter name 2")
.ConfigureAwait(false);

Parameter purpose : ParameterPurpose *

ParameterPurpose defines the behavior for saving the parameter.

Identify by full name : Boolean *

The flag for the file name: if true, the full file name is used as the key in the dictionary; if false, the file name without the extension is used as the key in the dictionary.

Default value: true

Adding files with the same name to the dictionary will throw an exception.

Sub directory : Boolean *

The flag for adding nested subdirectories: if true, the nested subdirectories will be also added; if false, the nested subdirectories won't be added.

Default value: true

Mask sub directories : String *

Mask for subdirectories. Only those subdirectories that meet the mask will be added. Read about masks.

Default value: *

DirectoryCompress

Compressing Directory.

Parameters:

Archive path : String *

The archive path.

Directory path : String *

The path to the directory to be compressed.

Sub directory : Boolean *

The flag for copying nested subdirectories: if true, the nested subdirectories will be also copied; if false, the nested subdirectories won't be copied.

Default value: true

Mask sub directories : String *

Mask for subdirectories. Only those subdirectories that meet the mask will be compressed. Read about masks.

Default value: *

Mask files : String *

Mask for files. Only those files that meet the mask will be compressed. Read about masks.

Default value: *

Archive type : ArchiveType *

The archive format the directory is compressed into.

Default value: ZIP

FilesCompress

Compressing List of Files.

Parameters:

Archive path : String *

The archive path.

Files paths : String *

The list of the paths for the files to be compressed.

Example: file path 1, file path 2.

The files «file path 1», «file path 2» will be compressed.

Mask files : String *

The mask for files. Only those files that meet the mask will be compressed. Read about masks.

Archive type : ArchiveType *

The archive format the files are compressed into.

Default value: ZIP

FileUncompress

Uncompress Archive Files.

Parameters:

Archive : String *

The archive path.

Directory path : String *

The path to uncompress the files.

Archive type : ArchiveType *

The archive format the files are uncompressed from.

Default value: ZIP

Conditions

FileExists

Check if File Exists.

Parameters:

Path : String *

The path to the file to be checked for existence.

FilesListExists

Check List of Files for Existence.

Parameters:

Files list exists : String *

The list of file paths to be checked for existence.

Example: file path 1, file path 2.

The files «file path 1» and «file path 2» will be checked for existence.

Concatenation - the method to concatenate the results. Read about concatenation.

DirectoryExists

Check if Directory Exists.

Parameters:

Path : String *

The path to the directory to be checked for existence.

Elements

ParameterPurpose

Setting Behavior for Saving Parameter.

ValueDescription
TemporaryTemporary Parameter exists from the time of its conveying to a process, or its setting within a process, till the end of the transition process. In other words, if you convey Parameter with Purpose = Temporary to the process through Command, it will be possible to obtain its Value only until the process stops and begins waiting for another Command.
PurposePersistence Parameter is stored in a database in the WorkflowProcessInstancePersistence table (or object). Its Value may be accessed at any time after it has been set.
SystemSystem Parameters cannot be created; they are used by Workflow Engine for its proper operation. You may access them trough the ProcessInstance object.

Protocol

Data Transfer Protocol.

ValueDescription
FTPFile Transfer Protocol
SFTPSSH File Transfer Protocol
HTTP/HTTPSHyperText Transfer Protocol

ParameterType

Data Format for Reading from File.

ValueDescription
StringThe data will be stored as a string. This format should be used when working with a text file.
ByteThe data will be stored as a Byte array. This format should be used when working with a non-text file.

Masks

Mask for Finding Files and Directories.

Parameters

File masks can be any combination of the following:

  • Fixed characters

    Letters, numbers and other characters allowed in file names.

  • Question mark (?)

    Represents any single character.

  • Asterisk (*)

    Represents any sequence of characters (including no characters at all).

Examples:

File MaskDescription & Examples
*Matches all files containing any amount of characters, with or without extensions (e.g., entering A* would match any file or folder starting with the letter A followed by any amount of characters).
*.*Matches all files containing any amount of characters and with any extension. Even matches files that don't have an extension (e.g., entering A*.* would match any file starting with the letter A followed by any amount of characters along with any extension).
?Matches any single character (e.g., entering A? would match any file starting with the letter A followed by any single character).
*.pngMatches all files with names containing any amount of characters with a .png extension (e.g., image_name.png, cool_pic.png, 1.png).
*.p*Matches all files with names containing any amount of characters with an extension starting with the letter p (e.g., document.pdf, image_name.png, business.project, 1.ppt).
pic*.*Matches all files with names that start with pic (e.g., picture_name.png, pictogram.ico, picker.html, pic).
*mat?.htmlMatches all .html files with names starting with any sequence of characters, followed by the string mat, and ending with a single character (e.g., automate.html, mate.html, tomato.html).
??????Matches all files with names containing six characters and without an extension (e.g., 123456, myFile, my_pic, images).
doc?????.pdfMatches all .pdf files with names that start with doc followed by any five characters (e.g., document.pdf, doctrine.pdf, doc_1234.pdf).
file1.txt file2.jpg file3.pngMatches specific filenames or wildcard masks that reside in the same directory (e.g., c:\temp\file1.txt\
c:\temp1\*.txt c:\temp2\*.pngMatches specific filenames or wildcard masks that reside in different directories (e.g., c:\temp1\photo.txt; c:\temp2\music.png).

ArchiveType

ValueDescription
ZIPThe archive format most commonly used on Windows OS.
TarGZThe archive format most commonly used on Linux and Mac OS.

Concatenation

ValueDescription
AndConcatenation with conjunction.
OrConcatenation with disjunction.