Getting Started > Use Lua Scripts > Method Reference > File System Methods

File System Methods
abs_path
Returns the supplied path as an absolute path.
Syntax
abs_path( String path )
Arguments
 
Returns
Returns a string of the supplied path as an absolute path.
copy_file
Copy the source file to the destination path. The copy will fail if the destination file already exists. This can be overridden by providing the optional overwrite argument which forces the copy if the destination exists.
Syntax
copy_file( String src, String dest [, Boolean overwrite] )
Arguments
 
Returns
Returns a Boolean indicating success/failure.
create_path
Creates the specified directory tree.
Syntax
void create_path (String Path)
Arguments
 
delete_file
Delete the file specified by path.
Syntax
delete_file( String path )
Arguments
 
Returns
Returns a Boolean indicating success/failure.
file_setdates
Sets the given file times on the file specified by path. If the format parameter is not specified, it is assumed that the dates are provided as seconds since the epoch (1st January 1970).
Syntax
file_setdates( String path, String created, String modified, String accessed [, String format] )
Arguments
 
Used to format the strings coming in at system time. The format parameter is the same as for other Autonomy products.
getcwd
Returns the current working directory of the application.
Syntax
getcwd()
Returns
Returns a string of the current working directory.
is_dir
Check if the supplied path is a directory.
Syntax
is_dir( String path )
Arguments
 
Returns
Returns a Boolean indicating if the supplied path is a directory.
move_file
Move the source file to the destination path. The move will fail if the destination file already exists. This can be overridden by providing the optional overwrite argument which forces the move if the destination exists.
Syntax
move_file( String src, String dest [, Boolean overwrite] )
Arguments
 
Returns
Returns a boolean indicating success/failure.
unzip_file
Extracts the zip file specified by path to the location specified by dest.
Syntax
unzip_file( String path, String dest )
Arguments
 
Returns
Returns a boolean indicating success/failure.
zip_file
Zip the supplied path (file or directory). The output file will only be overwritten if true is supplied for the optional overwrite argument.
Syntax
zip_file( String path [, Boolean overwrite] )
Arguments
 
Returns
The output path is written to path.zip. Returns Boolean indicating success or failure.