File Operations

The automation tools modules for file operations can create, read, copy, move, rename, delete, or verify the existence of files.

TBox Image Compare

Allows you to verify pixel-accurate image files in the following formats: BMP, JPG, and GIF.

Value

Description

FirstImageFilePath

Path and file name of the first image file.

SecondImageFile

Path and file name of the image file that you want to compare to the first image file.

TBox File Existence

Verifies whether a file exists in a specific directory.

Value

Description

Directory

Path to the file.

File

Name of the file whose existence you want to verify. You can use action mode Verify or WaitOn.

You can verify the name as follows:

  • To verify that a specified file does not exist, put the negation symbol ! in front of the file name.

  • To verify if multiple files exist, use the wildcard character * to replace one or more characters in the file name.

  • To verify if a file exists when you only know a part of the file name and the directory, use an XBuffer. This will buffer all the missing parts into an array. Note that Tosca Cloud doesn't support regular expressions, negation, and multiple uses of the same XBuffer within a single expression.

TBox File Compare

Compares the content of two files and see the results in a merged file.

Value

Description

FirstFilePath

Full path to the first file, including the name and extension.

SecondFilePath

Full path to the second file, including the file name and extension.

DiffReportOutputFolder

If you want to save a merged file to compare the differences, specify a path.

You can verify the changes in the merged file as follows:

  • If the second file has additional content, the TBox File Compare module highlights this in green.

  • If the second file has missing content, the TBox File Compare module highlights this in red.

  • If the contents are the same, the TBox File Compare module won't make any changes.

TBox Copy File

Copies and pastes files within the Microsoft Windows file system. If you want to paste a file into another directory, that directory must already exist at runtime. Note that this module may not work if you use a security and password management tool.

Value

Description

Source

Path and file name of the file that you want to copy.

Target Directory

Directory to which you want to paste the file.

Target Filename

If you want to rename the file, specify the new file name.

Overwrite

By default, Tosca Cloud doesn't overwrite existing files. If you want to overwrite the existing file, set the value to True.

TBox Delete File

Removes a file from a specific directory.

Value

Description

Directory

Path to the file you want to delete.

File

Name of the file you want to delete. To delete multiple files, use the wildcard character * to replace zero or more characters in the file name.

TBox Read/Create file

Performs the following actions:

  • Creates a text file.

  • Write text to a text file.

  • Verify or buffer text in the file.

  • Wait on text in the text file.

Value

Description

Directory

Path to the file you want to create or read.

File

Name of the file, including the file extension.

Text

Text you want to write, verify, buffer, or wait on. Use the Input, Verify, Buffer, or WaitOn action Mode, respectively.

Encoding

.NET character encoding of the file that you want to create. This is optional.

You can select from the following encoding options: UTF-8, UTF-16 and ISO-8859-1.

Overwrite

If you want to overwrite the target file, set the value to True and use action mode Input.

Add Byte Order Mark

Specify whether you want to add a byte order mark (BOM) to the preamble of your file. This is optional and only applies to files with UTF-8 or UTF-16 encoding.

By default, Tosca Cloud automatically adds a BOM to files with UTF-16 encoding. To add a BOM, note the following:

  • If you want to add a BOM to a file encoded with UTF-8, use the value True.

  • If you don't want Tosca Cloud to add a BOM to a file encoded with UTF-16, use the value False.

TBox Append File

Appends the Text value to the defined file. If you define a file that doesn't yet exist, Tosca Cloud will create it.

Value

Description

Filepath

Full path to the file where it is located.

Test

Text that should be appended.

End with Newline

Optionally, set the value to True if you want the text to be appended with Newline at the end.

Encoding

Optionally, specify the character encoding of the file to which you want to append the Text.

You can select one of the following encoding options: UTF-8, UTF-16 and ISO-8859-1.

TBox Move/Rename File

Moves and renames a file. If you want to move the file to another directory, that directory must already exist at runtime.

Value

Description

Existing Path

Path, file name, and extension of the file that you want to move or rename.

New Path

New path and/or file name. Note the following:

  • To only rename the file, enter its current path and a new file name.

  • To only move the file, enter a new path and the current file name.

TBox Zip File

Creates an archive in a zip file.

Value

Description

Source

File or directory path to the file you want to archive. To specify multiple files and directories, use a semicolon (;).

Destination

File path of the directory to create, e.g. C:\example.zip.

Overwrite

If set to True, this overwrites the file you've specified in the Destination.

TBox Unzip File

Extracts a zip file.

Value

Description

Archive

Path to the file you want to extract.

Destination

Path to the directory where you want to locate the extracted zip file. If the directory doesn't exist, it will be created automatically.

Overwrite

If set to True, this overwrites extracted files in the folder you specify in the Destination.