User manual
Section 9: Files Series 3700 System Switch/Multimeter Reference Manual
9-10 3700S-901-01 Rev. C / July 2008
fs.readdir()
Function
Returns a list of all the file system entries within a specified directory.
Usage
files = fs.readdir(path)
files: A list containing the names of all the file system entries that reside in the
specified directory.
path: The directory path. This path may be absolute or relative to the current working
directory.
Remarks
This command is non-recursive (that is, entries in subfolders are not returned). An
error is logged to the error queue if the given path does not exist, or does not
represent a directory.
fs.rmdir()
Function
Removes a directory from the file system.
Usage
fs.rmdir(path)
path: The path of the directory to remove. This path may be absolute or relative to the
current working directory.
Remarks
An error is logged to the error queue if the given path does not exist, does not
represent a directory, or if the directory is not empty.
file:close()
Function
Closes a file after flushing any data that was written to it with io.write() (on page
9-14) or file:write() (on page 9-11).
Usage
file:close()
file: The descriptor of the file to close.
Remarks
This command is equivalent to io.close(file). It is not remotely accessible.
file:flush()
Function
Flush the buffered data for the specified file
Usage
file:flush()
file: The descriptor of the file to flush
Remarks
Use this command to flush data written to it by file:write() (on page 9-11) or
io.write() (on page 9-14). Using this function removes the need to close a file
after writing to it and allows it to be left open to write more data. Data may be lost if the
file is not closed or flushed before an application ends. To prevent the loss of data if
there is going to be a time delay before more data is written when you want to keep file
open and not close it, flush the file after writing to it.