Section 11: TSP command reference Model 2601B-PULSE System SourceMeter Instrument Reference Manual
11-96 2601B-PULSE-901-01A April 2020
Example
rootDirectory = "/usb1/"
entries = fs.readdir(rootDirectory)
count = table.getn(entries)
print("Found a total of "..count.." files and directories")
for i = 1, count do
print(entries[i])
end
Insert a USB flash drive into the front panel of the instrument.
Set rootDirectory to be the USB port.
Set entries as the variable for the file system entries in rootDirectory.
Return the number of files and directories in the directory.
Also see
None
fs.rmdir()
This function removes a directory from the file system.
Usage
fs.rmdir("path")
The path of the directory to remove
Details
This path may be absolute or relative to the present working directory.
An error is logged to the error queue if the given path does not exist or does not represent a directory.
An error is also logged if the directory is not empty.
Example
rootDirectory = "/usb1/"
tempDirectoryName = "temp"
if fs.is_dir(rootDirectory..tempDirectoryName) == false then
fs.mkdir(rootDirectory..tempDirectoryName)
end
fs.rmdir(rootDirectory..tempDirectoryName)
Insert a USB flash drive into the front panel of the instrument.
Set rootDirectory to be the USB port.
Set tempDirectoryName to be equivalent to temp.
Check to see if tempDirectoryName exists.
If it does not exist, create a directory named temp.
Remove the directory.
Also see
fs.mkdir() (on page 11-95)