FilePlugin API

This plugin implements functions used for file handling.

The FilePlugin use cases

Table of contents

  1. Actions
    1. FileRead
    2. FileWrite
    3. FileDelete
    4. FileDownload
    5. FileUpload
    6. FileMove
    7. FileCopy
    8. FileRename
    9. FilesListRead
    10. FilesListDelete
    11. FilesListMove
    12. FilesListCopy
    13. FilesListRename
    14. DirectoryCreate
    15. DirectoryDelete
    16. DirectoryMove
    17. DirectoryDownload
    18. DirectoryUpload
    19. DirectoryCopy
    20. DirectoryRename
    21. DirectoryGetFiles
    22. DirectoryGetDirectories
    23. DirectoryCompress
    24. FilesCompress
    25. FileUncompress
  2. Conditions
    1. FileExists
    2. FilesListExists
    3. DirectoryExists
  3. Elements
    1. ParameterPurpose
    2. Protocol
    3. ParameterType
    4. Masks
    5. ArchiveType
    6. Concatenation

Actions

Read about actions.

FileRead

Table of contents

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

Table of contents

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

Table of contents

Deleting File with Specified Path

Parameters:

Path : String *

The path to the file that should be deleted.

FileDownload

Table of contents

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 Uri 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

Table of contents

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

Table of contents

Moving File

Parameters:

Path : String *

The file path.

Path for move : String *

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

FileCopy

Table of contents

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

Table of contents

Renaming File

Parameters:

Path : String *

The file path.

New path : String *

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

FilesListRead

Table of contents

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

Table of contents`

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

Table of contents

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

Table of contents

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

Table of contents

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

Table of contents

Creating Directory

Parameters:

Path : String *

The path for the directory to be created.

DirectoryDelete

Table of contents

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

Table of contents

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

Table of contents

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

Table of contents

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

Table of contents

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

Table of contents

Renaming Directory

Parameters:

Path : String *

The path to the directory.

New path : String *

The path with the new name.

DirectoryGetFiles

Table of contents

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

Table of contents

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

Table of contents

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

Table of contents

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

Table of contents

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

Table of contents

Check if File Exists

Parameters:

Path : String *

The path to the file to be checked for existence.

FilesListExists

Table of contents

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

Table of contents

Check if Directory Exists

Parameters:

Path : String *

The path to the directory to be checked for existence.

Elements

ParameterPurpose

Table of contents

Setting Behavior for Saving Parameter

Value Description
Temporary Temporary 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.
Purpose Persistence 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. The third type of Purpose is a system one.
System System Parameters cannot be created; they are used by Workflow Engine for its proper operation. You may access them trough the ProcessInstance object. These Parameters will be discussed in detail further on.

Protocol

Table of contents

Data Transfer Protocol

Value Description
FTP File Transfer Protocol
SFTP SSH File Transfer Protocol
HTTP/HTTPS HyperText Transfer Protocol

ParameterType

Table of contents

Data Format for Reading from File

Value Description
String The data will be stored as a string. This format should be used when working with a text file.
Byte The data will be stored as a Byte array. This format should be used when working with a non-text file.

Masks

Table of contents

Mask for Finding Files and Directories

Parameters

Table of contents

File masks can consist of 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 Mask Description & 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).
*.png Matches 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?.html Matches 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?????.pdf Matches 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.png Matches specific filenames or wildcard masks that reside in the same directory (e.g., c:\temp\file1.txt
c:\temp1*.txt c:\temp2*.png Matches specific filenames or wildcard masks that reside in different directories (e.g., c:\photos*.jpg; \c:\music*.mp3).

ArchiveType

Table of contents

Value Description
ZIP The archive format most commonly used on Windows OS
TarGZ The archive format most commonly used on Linux and Mac OS

Concatenation

Table of contents

Value Description
And Concatenation with conjunction
Or Concatenation with disjunction
Top