Series 3700A System Switch/Multimeter Reference Manual
Section 9: Introduction to TSP operation
3700AS-901-01 Rev. D/June 2018
9-5
File system navigation
The Series 3700A can use commands from the Lua
fs
library to navigate and list files that are
available on a flash drive. These Lua commands are in the
fs
command group in the instrument.
The
fs
commands make the file system of any given node available to the entire TSP-Link
®
system.
For example, you can use the command
node[5].fs.readdir(".")
to read the contents of the
current working directory on node 5.
The root folder of the USB flash drive has the absolute path:
"/usb1/"
You can use either the slash (
/
) or backslash (
\
) as a directory separator. However, the backslash is
also used as an escape character, so if you use it as a directory separator, you will generally need to
use a double backslash (
\\
) when you are creating scripts or sending commands to the instrument.
The instrument supports the following Lua
fs
commands:
(on page 11-248)
(on page 11-249)
(on page 11-249)
(on page 11-249)
(on page 11-250)
(on page 11-250)
(on page 11-251)
The following Lua
fs
commands are not supported at this time:
fs.chmod()
fs.chown()
fs.stat()
Script examples
The following script will open three different files to help illustrate the differences between the
io
commands and file descriptor commands. After opening the files, the script designates each one as
the default output file (using the
io.output
command). While each file is the default for file writes
(using the
io.write
command), the script also uses the file descriptor from the
io.open
to write to
the file (
file:write
command).
After all files are closed (using the
io.close
command), the script will open the files again for
reading. Two files are read by:
•
Designating the file the default input file (using the
io.input
command)
•
Being the default read contents of file (using the
io.read
command)
The third file is read by using the file descriptor from the open (
file:read
command). After reading
all files, they are closed using the file descriptor and close option (
file:close
command).