Nexial Automation

Test Automation Platform for everyone!

X

$(file)

Description

This built-in function provides various file related operations.

Available Functions

$(file|append|file|content)

Append content to file and return the full path of file.

Example
Our file looks like this.

Script

Output


$(file|asList|file)

Read the content of file as a list where each line of the content is a list item. The return value is a list separated by nexial.textDelim.

Example Input File

Script

Output


$(file|content|file)

Read and return the content of file.

Example Input File

Script

Output


$(file|copy|file|target)

Copy file to target and return the full path of target.

Example Script

Output File


$(file|delete|file)

Delete file and return its full path.

Example Script

Output


$(file|dir|file)

Return the parent directory of file.

Example Script

Output


$(file|lastmod|file)

Return the last modified timestamp ( epoch) of file.

Example Script

Output


$(file|move|file|target)

Move file to target and return the full path of target.

Example Script

Output

File moved from data directory to output directory.


$(file|name|file)

Return the file name of file.

Example Script

Output


$(file|overwrite|file|content)

Overwrite the content of file with content and return the full path of file. file is created if need be.

Example Input File

Script

Output File

Output


$(file|prepend|file|content)

Prepend (add to the beginning of file) content to file and return the full path of file.

Example Script

Output File

Output


$(file|size|file)

Return the size of file.

Example
Size of DataFile.txt

Script

Output