File Operation Component

:icons:font :hardbreaks: :imagesdir: ../../../assets/images :toc-title: Contents :toc:

Description

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

Table 1. System characteristics

Index

109

Short name

file

Script types

All

Start module

r_script_component_file

Mode

Synchronous

Icon

109

Branching type

Branching, closing

Properties

Table 2. Properties
Specification Description

Name: Object type

Code: opType

Visibility condition: no

Default: File

Defines the type of object on which the file operation is performed.

Possible values:

  • Path (path,1) – Operations with the string representation of a path.

  • File (file,2) – Operations with files.

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

  • File contents (content,4) – Operations with file contents.

Name: Operation

Code: pathOps

Visibility condition: yes Default: Path type

Operation with string representation of path.

Possible values:

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

  • Relative path (getRelativePath, 102) – Returns the relative path, stripping the category from it.

  • Filename (getFileName, 103) – Returns the filename 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 a relative path, available for use in other operations and components.

  • Build file path (makeFilePath, 107) – Returns the file path, assembled from three arguments: path, file name and extension.

Name: Operation Code: fileOps Visibility condition: yes

Default: Check availability

File operation.

Possible values:

  • Delete (deleteFile, 201) – Deletes a file.

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

  • Move (moveFile, 203) – Moves a file to another directory.

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

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

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

  • Create path (ensureFolder, 208) – Creates a directory for the 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 Fax sending

Supported formats for converting to tiff: bmp, jpg, pdf, png, tiff.

Name: Operation

Code: folderOps

Visibility condition: yes

Default: Check availability

Directory 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 for existence (folderExists, 306) – Returns 1 if the directory exists, otherwise 0.

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

  • Number of subdirectories (getFolderSubfolderCount, 308) – Returns the number of subdirectories at the first level.

Name: Operation

Code: contentOps

Visibility condition: yes Default: Read file

Operation with file contents.

Possible values:

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

  • Write File (writeFile, 402) – Writes new content to an existing file.

  • Append to end of file (appendFile, 403) – Appends content to the end of the file.

  • Read file (readFile, 404) – Returns the contents of the file.

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

Name: Path

Code: path

Visibility condition: yes

Default: — 

An argument containing the path.

Name: Cut extension

Code: cutExtension

Visibility condition: yes

Default: Yes

File return mode switch without extension.

Name: Directory Category

Code: folderType

Visibility condition: yes Default: SYNC_COMMON

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

Possible values:

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

  • SYNC_DOMAIN_COMMON (2) – Directory of general domain data in a directory synchronized between servers.

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

  • SYNC_SCRIPT_DATA (4) – Directory of script data in synchronization between servers.

  • SITESHARE_PUBLIC (5) – Directory of general data on a network drive of site storage, accessible to all servers on the site.

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

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

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

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

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

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

Name: Relative path

Code: tail

Visibility condition: yes Default: — 

An argument containing a relative path.

Name: File name

Code: fileName

Visibility condition: yes

Default: — 

An argument containing the file name.

Name: Extension Code: fileExtension Visibility condition: yes

Default: — 

An argument containing the file extension.

Name: Source path

Code: sourcePath

Visibility condition: yes

Default: — 

Argument containing the source path.

Name: Destination path

Code: destinationPath

Visibility condition: yes

Default: — 

Argument containing the destination path.

Name: Hash function

Code: hashFunction

Visibility condition: yes Default: MD5

Hash function to apply to the file contents.

Name: Content

Code: fileData

Visibility condition: yes

Default: — 

Argument with the contents of the file.

Name: Encoding Code: encodingType Visibility condition: yes

Default: Auto

Encoding to apply to the file content when reading into a variable and vice versa.

Possible values:

  • Auto (1) – Automatic detection.

  • Binary data (binary, 2) – Reading binary data without conversion.

  • utf-8 (3)

  • utf-16 (4)

  • utf-32 (5)

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

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

Name: BOM Code: utfBOM

Visibility condition: yes

Default: With BOM

Mode of reading file contents taking into account the encoding prefix for UTF.

Possible options:

  • With BOM (withBOM, 1).

  • Without BOM (withoutBOM, 2).

Name: Endian Code: utfEndian

Visibility condition: yes

Default: Little-Endian

Unicode layout mode.

Possible options:

  • Little-Endian (littleEndian, 1).

  • Big-Endian (bigEndian, 2).

Name: Encoding name

Code: encodingName

Visibility condition: yes

Default: "cp1251"

An argument containing the name of the encoding to use.

Name: Result into variable

Code: result

Visibility condition: no Default: — 

Variable for storing the result of the operation.

Name: Error code into variable

Code: errorReason

Visibility condition: no

Default: — 

Variable for storing the operation error code.

Name: Transition Code: transfer Visibility condition: no

Default: — 

The component to which control is transferred if the operation completes successfully.

Name: Transition, not found

Code: transferNotFound

Visibility condition: yes

Default: — 

The component to which control is transferred if there is no object at the specified path.

Name: Transition, error

Code: transferError

Visibility condition: no

Default: — 

The component to which control is transferred if the operation fails.

See also