Component File operation

Table of Contents

Description

Performs the specified I/O operation on the disk. Works with files, directories, paths.

Table 1. System Characteristics

Index

109

Short title

file

Types of scenarios

All of them

Starter module

r_script_component_file

Mode

Synchronous

Icon

109

Branching pattern

Branching, closing

Properties

Table 2. Properties
Specification Description

Title: Object Type
Code: opType
Visibility: no
Default: File

Specifies the type of object on which the file operation is performed.
Possible values:

  • Path (path,1) - Operations with string representation of path.

  • File (file,2) - File operations.

  • Directory (folder,3) - Operations with directories.

  • File content (content,4) - Operations on the contents of a file.

Title: Operation
Code: pathOps
Visibility: yes
Default: Path type

Operation with string representation of path.
Possible values:

  • PathType (getPathType, 101) - Returns the directory category of the specified path.

  • RelativePath (getRelativePath, 102) - Returns a relative path, cutting a category from it.

  • FileName (getFileName, 103) - Returns the name of a file from the specified path.

  • Extension (getFileExtension, 104) - Returns the file extension from the specified path.

  • Directory (getFileDirectory, 105) - Returns the directory name from the specified path.

  • Build Path (makePath, 106) - Returns a path assembled from a directory category and relative path, available for use in other operations and components.

  • Build File Path (makeFilePath, 107) - Returns a file path assembled from three arguments: path, filename, and extension.

Title: Operation
Code: fileOps
Visibility: yes
Default: `Check Availability'

File operation.
Possible values:

  • Delete (deleteFile, 201) - Deletes the file.

  • Copy (copyFile, 202) - Copies a file.

  • Move (moveFile, 203) - Moves the file to another directory.

  • Check Existence (fileExists, 205) - Returns 1 if the file exists, otherwise 0.

  • Size (getFileSize, 206) - Returns the size of the file.

  • Content Hash (getFileHash, 207) - Returns a hash of the contents of the file.

  • Create path (ensureFolder, 208) - Creates a directory for a file at the specified path if it does not exist.

  • Convert to tiff (fileToFaxTiff, 209) - Converts the file to tiff, with parameters suitable for the component Sending Fax
    Supported formats for conversion to tiff: bmp, jpg, pdf, png, tiff.

Title: Operation
Code: folderOps
Visibility: yes
Default: `Check Availability'

Catalog Operation.
Possible values:

  • Create (makeFolder, 301) - Creates a directory if it does not exist.

  • Delete (deleteFolder, 302) - Deletes a directory.

  • Copy (copyFolder, 303) - Copies a directory with all its contents.

  • Move (moveFolder, 304) - Moves a directory with all its contents to another directory.

  • Check Availability (folderExists, 306) - Returns 1 if the directory exists, otherwise 0.

  • FileCount (getFolderFileCount, 307) - Returns the number of files in the directory at the first level.

  • SubfolderCount (getFolderSubfolderCount, 308) - Returns the number of subfolders at the first level.

Title: Operation
Code: contentOps
Visibility: yes
Default: Read file

Operation on file contents.
Possible values:

  • Create File (createFile, 401) - Creates a new file with the specified contents.

  • WriteFile (writeFile, 402) - Writes new content to an existing file.

  • Add to end of file (appendFile, 403) - Adds content to the end of the file.

  • Read File (readFile, 404) - Returns the contents of a file.

All content operations use the specified encoding to convert from string to binary form.

Title: The Path
Code: path
Visibility: yes
Default: — 

Argument containing path.

Title: Reduce Extension
Code: cutExtension
Visibility: yes
Default: `Yes'

Return mode switch for file without extension.

Title: Catalog Category
Code: folderType
Visibility: yes
Default: SYNC_COMMON

The directory category that makes the path available for use in I/O operations.
Possible values:

  • SYNC_COMMON (1) – A directory of common data of all domains in a directory synchronized between servers.

  • SYNC_DOMAIN_COMMON (2) – A directory of shared domain data in a directory that is synchronized between servers.

  • SYNC_DOMAIN_DATA (3) – Domain data directory in a directory that is synchronized between servers.

  • SYNC_SCRIPT_DATA (4) – A directory of script data in sync between servers.

  • SITESHARE_PUBLIC (5) – A directory of shared data on the network drive of the site storage, accessible to all servers on the site.

  • SITESHARE_DOMAIN_DATA (6) – A directory of domain data on a network drive of the site storage, accessible to all servers on the site.

  • SITESHARE_SCRIPT_DATA (7) – A catalog of script data on the network drive of the site storage, accessible to all servers at the site.

  • GLOBALSHARE_PUBLIC (8) – A shared data directory on a network drive of global storage accessible to all sites.

  • GLOBALSHARE_DOMAIN_DATA (9) – A directory of domain data on a network drive of global storage accessible to all sites.

  • GLOBALSHARE_SCRIPT_DATA (10) – A catalog of script data on a network drive of global storage accessible to all sites.

  • TEMP (11) – Temporary directory of the current script handler. It is deleted 5 seconds after its completion.

Title: The Relative Way
Code: tail
Visibility: yes
Default: — 

An argument containing a relative path.

Title: File Name
Code: fileName
Visibility: yes
Default: — 

Argument containing the file name.

Title: Extension
Code: fileExtension
Visibility: yes
Default: — 

Argument containing the file extension.

Title: The Path of the Source
Code: sourcePath
Visibility: yes
Default: — 

Argument containing the source path.

Title: Destination
Code: destinationPath
Visibility: yes
Default: — 

Argument containing the destination path.

Title: Hash function
Code: hashFunction
Visibility: yes
Default: MD5

Hash function to apply to the contents of the file.

Title: Content
Code: fileData
Visibility: yes
Default: — 

Argument with the contents of the file.

Title: Coding
Code: encodingType
Visibility: yes
Default: Auto

Encoding to apply to file contents when reading to a variable and vice versa.
Possible values:

  • Auto (1) - Automatic detection.

  • Binary data (binary, 2) - Read binary data without conversion.

  • utf-8 (3)

  • utf-16 (4)

  • utf-32 (5)

  • cp1251 (6) – The windows-1251 (Cyrillic) code page.

  • Specify name (byname, 7) - Specifies the name of the encoding.

Name: BOM
Code: utfBOM
Visibility: yes
Default: With BOM

Mode of reading file content with encoding prefix for UTF.
Possible options:

  • C BOM (withBOM, 1).

  • Without BOM (withoutBOM, 2).

Name: Endian
Code: utfEndian
Visibility: yes
Default: Little-Endian

Encoding Layout Mode unicode.
Possible options:

  • Little-Endian (littleEndian, 1).

  • Big-Endian (bigEndian, 2).

Title: Encoding name
Code: encodingName
Visibility: yes
Default: "cp1251"

An argument containing the name of the encoding to be used.

Title: Result to variable
Code: result
Visibility: no
Default: — 

Variable to save the result of the operation.

Title: Error code to variable
Code: errorReason
Visibility: no
Default: — 

Variable to store the operation error code.

Title: Transition
Code: transfer
Visibility: no
Default: — 

The component to which control is passed if the operation is successfully completed.

Title: Transition, not found
Code: transferNotFound
Visibility: yes
Default: — 

The component to which control is passed if the object at the specified path does not exist.

Title: Transition, Error
Code: transferError
Visibility: no
Default: — 

Component to which control is passed in case of an operation execution error.

See also