Absolute Path
Returns the absolute path to a file, and resolves symlinks.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path that will be resolved |
param path: | path that will be resolved |
---|---|
return: | absolute path to file as a string |
Append To Binary File
Appends binary content to the given file.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to file to append to | |
content | null | content 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 |
---|---|---|---|
path | null | path to file to append to | |
content | null | content to append | |
encoding | utf-8 | character 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 |
---|---|---|---|
path | null | path to file to rename | |
extension | null | new 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 |
---|---|---|---|
source | null | path to source directory | |
destination | null | path 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 |
---|---|---|---|
source | null | path to source file | |
destination | null | path 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 |
---|---|---|---|
sources | null | list of source files | |
destination | null | path 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 |
---|---|---|---|
path | null | path to file to write | |
content | None | content to write to file (optional) | |
overwrite | False | replace 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 |
---|---|---|---|
path | null | path to new directory | |
parents | False | create missing parent directories | |
exist_ok | True | continue 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 |
---|---|---|---|
path | null | path to file to write | |
content | None | content to write to file (optional) | |
encoding | utf-8 | character encoding of written content | |
overwrite | False | replace 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 |
---|---|---|---|
path | null | path to inspected directory |
param path: | path to inspected directory |
---|---|
return: | true or false if the directory exists |
Does Directory Not Exist
Returns True if the directory does not exist, False if it does.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to inspected directory |
param path: | path to inspected directory |
---|---|
return: | true or false if the directory does not exists |
Does File Exist
Returns True if the given file exists, False if not.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to inspected file |
param path: | path to inspected file |
---|---|
return: | true or false if file exists |
Does File Not Exist
Returns True if the file does not exist, False if it does.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to inspected file |
param path: | path to inspected file |
---|---|
return: | true or false if the files does not exist |
Empty Directory
Removes all the files in the given directory.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | directory 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 |
---|---|---|---|
pattern | null | search path in glob format pattern, e.g. .xls or */orders.txt | |
include_dirs | True | include directories in results | |
include_files | True | include 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 |
---|---|---|---|
path | null | path 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 |
---|---|
return: | creation time in seconds as a float |
Get File Extension
Returns the suffix for the file.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to file |
param path: | path to file |
---|---|
return: | file suffix as a string |
Get File Modified Date
Returns the modified time in seconds.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to file to inspect |
param path: | path to file to inspect |
---|---|
return: | modified time in seconds as a float |
Get File Name
Returns only the filename portion of a path.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to file |
param path: | path to file |
---|---|
return: | filename portion of a path as a string |
Get File Owner
Return the name of the user who owns the file.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to file to inspect |
param path: | path to file to inspect |
---|---|
return: | file owner as a string |
Get File Size
Returns the file size in bytes.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to file to inspect |
param path: | path to file to inspect |
---|---|
return: | file size in bytes as an int |
Is Directory Empty
Returns True if the given directory has no files or subdirectories.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | None | path to inspected directory |
param path: | path to inspected directory |
---|---|
return: | true or false if the directory is empty |
Is Directory Not Empty
Returns True if the given directory has any files or subdirectories.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | None | path to inspected directory |
param path: | path to inspected directory |
---|---|
return: | true or false if the directory is not empty |
Is File Empty
Returns True if the given file has no content, i.e. has zero size.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to inspected file |
param path: | path to inspected file |
---|---|
return: | true or false if the file is empty |
Is File Not Empty
Returns True if the given file has content, i.e. larger than zero size.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to inspected file |
param path: | path to inspected file |
---|---|
return: | true or false if the file is not empty |
Join Path
Joins multiple parts of a path together.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
parts | null | Components of the path, e.g. dir, subdir, filename.ext |
param parts: | Components of the path, e.g. dir, subdir, filename.ext |
---|---|
return: | complete file path as a single string |
List Directories In Directory
Lists all the directories in the given directory, relative to it.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | None | base directory for search, defaults to current working dir |
param path: | base directory for search, defaults to current working dir |
---|---|
return: | list of directories in slected directory |
List Files In Directory
Lists all the files in the given directory, relative to it.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | None | base directory for search, defaults to current working dir |
param path: | base directory for search, defaults to current working dir |
---|---|
return: | list of files in directory |
Log Directory Tree
Logs all the files in the directory recursively.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | None | base 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 |
---|---|---|---|
source | null | source directory path for moving | |
destination | null | path to move to | |
overwrite | False | replace 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 |
---|---|---|---|
source | null | source file path for moving | |
destination | null | path to move to | |
overwrite | False | replace 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 |
---|---|---|---|
sources | null | list of files to move | |
destination | null | path to move destination | |
overwrite | False | replace 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 |
---|---|---|---|
path | null | path that will be normalized |
param path: | path that will be normalized |
---|---|
return: | path to file as a string |
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 |
---|---|---|---|
path | null | path 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 |
---|---|
return: | the file content as bytes |
Read File
Reads a file as text, with given `encoding`, and returns the content."
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to file to read | |
encoding | utf-8 | character encoding of file |
Reads a file as text, with given encoding, and returns the content."
param path: | path to file to read |
---|---|
param encoding: | character encoding of file |
return: | file content as string |
Remove Directory
Removes the given directory, and optionally everything it contains.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to directory | |
recursive | False | remove 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 |
---|---|---|---|
path | null | path to the file to remove | |
missing_ok | True | ignore 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 | null | paths to files to be removed | |
missing_ok | True | ignore 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 |
---|---|---|---|
path | null | path to file to inspect | |
keyword | null | Robot Framework keyword to execute | |
args | null | arguments to keyword |
If file exists at path, execute given keyword with arguments.
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 |
---|---|---|---|
path | null | path 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 |
---|---|---|---|
path | null | path to poll | |
timeout | 5.0 | time 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 |
return: | path to the created file as a string |
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 |
---|---|---|---|
path | null | path to poll | |
timeout | 5.0 | time 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 |
return: | path to the modified file as a string |
Wait Until Removed
Poll path until it doesn't exist, or raise exception if timeout is reached.
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
path | null | path to poll | |
timeout | 5.0 | time 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 |