Absolute Path

Returns the absolute path to a file, and resolves symlinks.

Arguments

Argument Type Default value Description
pathpath that will be resolved
param path:path that will be resolved
return:absolute path to file

Append To Binary File

Appends binary content to the given file.

Arguments

Argument Type Default value Description
pathpath to file to append to
contentcontent to append
param path:path to file to append to
param content:content to append

Append To File

Appends text to the given file.

Arguments

Argument Type Default value Description
pathpath to file to append to
contentcontent to append
encodingutf-8character encoding of appended content
param path:path to file to append to
param content:content to append
param encoding:character encoding of appended content

Change File Extension

Replaces file extension for file at given path.

Arguments

Argument Type Default value Description
pathpath to file to rename
extensionnew extension, e.g. .xlsx
param path:path to file to rename
param extension:
 new extension, e.g. .xlsx

Copy Directory

Copy directory from source path to destination path.

Arguments

Argument Type Default value Description
sourcepath to source directory
destinationpath to copy destination
param source:path to source directory
param destination:
 path to copy destination

Copy File

Copy a file from source path to destination path.

Arguments

Argument Type Default value Description
sourcepath to source file
destinationpath to copy destination
param source:path to source file
param destination:
 path to copy destination

Copy Files

Copy multiple files to destination folder.

Arguments

Argument Type Default value Description
sourceslist of source files
destinationpath to destination folder
param sources:list of source files
param destination:
 path to destination folder

Create Binary File

Creates a new binary file, and writes content if any is given.

Arguments

Argument Type Default value Description
pathpath to file to write
contentNonecontent to write to file (optional)
overwriteFalsereplace destination file if it already exists
param path:path to file to write
param content:content to write to file (optional)
param overwrite:
 replace destination file if it already exists

Create Directory

Creates a directory and (optionally) non-existing parent directories.

Arguments

Argument Type Default value Description
pathpath to new directory
parentsFalsecreate missing parent directories
exist_okTruecontinue without errors if directory already exists
param path:path to new directory
param parents:create missing parent directories
param exist_ok:continue without errors if directory already exists

Create File

Creates a new text file, and writes content if any is given.

Arguments

Argument Type Default value Description
pathpath to file to write
contentNonecontent to write to file (optional)
encodingutf-8character encoding of written content
overwriteFalsereplace destination file if it already exists
param path:path to file to write
param content:content to write to file (optional)
param encoding:character encoding of written content
param overwrite:
 replace destination file if it already exists

Does Directory Exist

Returns True if the given directory exists, False if not.

Arguments

Argument Type Default value Description
pathpath to inspected directory
param path:path to inspected directory

Does Directory Not Exist

Returns True if the directory does not exist, False if it does.

Arguments

Argument Type Default value Description
pathpath to inspected directory
param path:path to inspected directory

Does File Exist

Returns True if the given file exists, False if not.

Arguments

Argument Type Default value Description
pathpath to inspected file
param path:path to inspected file

Does File Not Exist

Returns True if the file does not exist, False if it does.

Arguments

Argument Type Default value Description
pathpath to inspected file
param path:path to inspected file

Empty Directory

Removes all the files in the given directory.

Arguments

Argument Type Default value Description
pathdirectory to remove files from
param path:directory to remove files from

Find Files

Find files recursively according to a pattern.

Arguments

Argument Type Default value Description
patternsearch path in glob format pattern, e.g. .xls or */orders.txt
include_dirsTrueinclude directories in results
include_filesTrueinclude files in results
param pattern:search path in glob format pattern, e.g. .xls or */orders.txt
param include_dirs:
 include directories in results
param include_files:
 include files in results
return:list of paths that match the pattern

Get File Creation Date

Returns the creation time in seconds. Note: Linux sets this whenever file metadata changes

Arguments

Argument Type Default value Description
pathpath to file to inspect

Returns the creation time in seconds. Note: Linux sets this whenever file metadata changes

param path:path to file to inspect

Get File Extension

Returns the suffix for the file.

Arguments

Argument Type Default value Description
pathpath to file
param path:path to file

Get File Modified Date

Returns the modified time in seconds.

Arguments

Argument Type Default value Description
pathpath to file to inspect
param path:path to file to inspect

Get File Name

Returns only the filename portion of a path.

Arguments

Argument Type Default value Description
pathpath to file
param path:path to file

Get File Size

Returns the file size in bytes.

Arguments

Argument Type Default value Description
pathpath to file to inspect
param path:path to file to inspect

Is Directory Empty

Returns True if the given directory has no files or subdirectories.

Arguments

Argument Type Default value Description
pathNonepath to inspected directory
param path:path to inspected directory

Is Directory Not Empty

Returns True if the given directory has any files or subdirectories.

Arguments

Argument Type Default value Description
pathNonepath to inspected directory
param path:path to inspected directory

Is File Empty

Returns True if the given file has no content, i.e. has zero size.

Arguments

Argument Type Default value Description
pathpath to inspected file
param path:path to inspected file

Is File Not Empty

Returns True if the given file has content, i.e. larger than zero size.

Arguments

Argument Type Default value Description
pathpath to inspected file
param path:path to inspected file

Join Path

Joins multiple parts of a path together.

Arguments

Argument Type Default value Description
*parts
param parts:Components of the path, e.g. dir, subdir, filename.ext

List Directories In Directory

Lists all the directories in the given directory, relative to it.

Arguments

Argument Type Default value Description
pathNonebase directory for search, defaults to current working dir
param path:base directory for search, defaults to current working dir

List Files In Directory

Lists all the files in the given directory, relative to it.

Arguments

Argument Type Default value Description
pathNonebase directory for search, defaults to current working dir
param path:base directory for search, defaults to current working dir

Log Directory Tree

Logs all the files in the directory recursively.

Arguments

Argument Type Default value Description
pathNonebase directory to start from, defaults to current working dir
param path:base directory to start from, defaults to current working dir

Move Directory

Move a directory from source path to destination path.

Arguments

Argument Type Default value Description
sourcesource directory path for moving
destinationpath to move to
overwriteFalsereplace destination directory if it already exists
param source:source directory path for moving
param destination:
 path to move to
param overwrite:
 replace destination directory if it already exists

Move File

Move a file from source path to destination path, optionally overwriting the destination.

Arguments

Argument Type Default value Description
sourcesource file path for moving
destinationpath to move to
overwriteFalsereplace destination file if it already exists

Move a file from source path to destination path, optionally overwriting the destination.

param source:source file path for moving
param destination:
 path to move to
param overwrite:
 replace destination file if it already exists

Move Files

Move multiple files to the destination folder.

Arguments

Argument Type Default value Description
sourceslist of files to move
destinationpath to move destination
overwriteFalsereplace destination files if they already exist
param sources:list of files to move
param destination:
 path to move destination
param overwrite:
 replace destination files if they already exist

Normalize Path

Removes redundant separators or up-level references from path.

Arguments

Argument Type Default value Description
pathpath that will be normalized
param path:path that will be normalized
return:path to file

Read Binary File

Reads a file in binary mode and returns the content. Does not attempt to decode the content in any way.

Arguments

Argument Type Default value Description
pathpath to file to read

Reads a file in binary mode and returns the content. Does not attempt to decode the content in any way.

param path:path to file to read

Read File

Reads a file as text, with given encoding, and returns the content."

Arguments

Argument Type Default value Description
pathpath to file to read
encodingutf-8character encoding of file
param path:path to file to read
param encoding:character encoding of file

Remove Directory

Removes the given directory, and optionally everything it contains.

Arguments

Argument Type Default value Description
pathpath to directory
recursiveFalseremove all subdirectories and files
param path:path to directory
param recursive:
 remove all subdirectories and files

Remove File

Removes the given file.

Arguments

Argument Type Default value Description
pathpath to the file to remove
missing_okTrueignore non-existent file
param path:path to the file to remove
param missing_ok:
 ignore non-existent file

Remove Files

Removes multiple files.

Arguments

Argument Type Default value Description
*paths
missing_okTrueignore non-existent files
param paths:paths to files to be removed
param missing_ok:
 ignore non-existent files

Run Keyword If File Exists

If file exists at path, execute given keyword with arguments.

Arguments

Argument Type Default value Description
pathpath to file to inspect
keywordRobot Framework keyword to execute
*args
param path:path to file to inspect
param keyword:Robot Framework keyword to execute
param args:arguments to keyword

Examples

*** Tasks ***
Run keyword if file exists    orders.xlsx    Process orders

Touch File

Creates a file with no content, or if file already exists, updates the modification and access times.

Arguments

Argument Type Default value Description
pathpath to file which is touched

Creates a file with no content, or if file already exists, updates the modification and access times.

param path:path to file which is touched

Wait Until Created

Poll path until it exists, or raise exception if timeout is reached.

Arguments

Argument Type Default value Description
pathpath to poll
timeout5.0time in seconds until keyword fails

Poll path until it exists, or raise exception if timeout is reached.

param path:path to poll
param timeout:time in seconds until keyword fails

Wait Until Modified

Poll path until it has been modified after the keyword was called, or raise exception if timeout is reached.

Arguments

Argument Type Default value Description
pathpath to poll
timeout5.0time in seconds until keyword fails

Poll path until it has been modified after the keyword was called, or raise exception if timeout is reached.

param path:path to poll
param timeout:time in seconds until keyword fails

Wait Until Removed

Poll path until it doesn't exist, or raise exception if timeout is reached.

Arguments

Argument Type Default value Description
pathpath to poll
timeout5.0time in seconds until keyword fails

Poll path until it doesn't exist, or raise exception if timeout is reached.

param path:path to poll
param timeout:time in seconds until keyword fails