Section 9: TSP command reference Series 2600B System SourceMeter® instrument Reference Manual
9-106 2600BS-901-01 Rev. F/August 2021
if fs.is_dir("/usb1/temp") == false then
fs.mkdir("/usb1/temp")
end
Insert a USB flash drive into the front panel of the instrument.
Check to see if the temp directory exists.
If it does not exist, create a directory named temp.
Also see
fs.rmdir() (on page 9-107)
fs.readdir()
This function returns a list of the file system entries in the directory.
Usage
files = fs.readdir("path")
A table containing the names of all the file system entries in the specified directory
Details
The directory path may be absolute or relative to the current working directory.
This command is nonrecursive. For example, 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.
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.