File Actions
File Actions are actions that can interact with files and folders on your computer.
Actions
file.copy
Copy a file or folder.
Parameters:
source - path to the source folder or file.
destination - path to the destionation of the coping folder or file.
Returns:
This action gives no return
Exceptions:
FileNotFoundException: if the source or destionation path is wrong or could not copy.
file.create_folder
Create a new folder in the given path.
This action only creates the last folder of the path
Parameters:
path - path to the folder to be created.
Returns:
This action gives no return
Exceptions:
FileNotFoundException: if the path is wrong or could not be created
file.delete
Deletes a file or folder on the given path.
Parameters:
path - path to the folder or file to delete
Returns:
This action gives no return
Exceptions:
FileNotFoundException: if the path is wrong or could not be deleted
file.file_exists
Checks if the file exists in the given path.
Parameters:
path - path to the file to check
Returns:
exists - True
if the file exists and False
if file does not exists.
file.folder_exists
Checks if the folder exists in the given path.
Parameters:
path - path to the folder to check
Returns:
exists - True
if the file exists and False
if file does not exists.
file.list_files
List all files from a given folder. This method support *
to filter files, as example:
c:/test/*.txt
c:/test/*.pdf
Parameters:
path - path or path pattern to return a list of files
Returns:
files - List with full path of all files inside the folder
file.move
Move a file or folder.
Parameters:
source - path to the source folder or file.
destination - path to the destionation of the moving folder or file.
Returns:
This action gives no return
Exceptions:
FileNotFoundException: if the source or destionation path is wrong or could not move.
file.newest_file
Return the path to the newest file of the given folder.
Parameters:
path - path to check the newest file in folder.
Returns:
path - path to newest file in folder
Exceptions:
FileNotFoundException: if the given folder does not exists
file.rename
Rename a file or folder.
Parameters:
source - path to the current folder or file.
destination - path to the new folder or file.
Returns:
This action gives no return
Exceptions:
FileNotFoundException: if the source or destionation path is wrong or could not rename.
file.size
Return the size of the file.
Parameters:
path - path to the current folder or file.
destination - path to the new folder or file.
Returns:
size - size of the file in bytes
sizeKB - size of the file in Kilobytes
sizeMB - size of the file in Megabytes