Section 9: TSP command reference Series 2600B System SourceMeter® instrument Reference Manual
9-104 2600BS-901-01 Rev. F/August 2021
if fs.is_dir("/usb1/temp") == true then
fs.chdir("/usb1/temp")
testPath = fs.cwd()
print(testPath)
else
testPath = fs.cwd()
print(testPath)
end
Insert a USB flash drive into the front panel of the instrument.
Verify that /usb1/temp is a directory and change it to be the current working directory.
Set the variable for the current working directory to be testPath.
The return should be:
/usb1/temp
If /usb1/temp is not a directory, set the variable for the current working directory to be testPath.
The return is:
/usb1
Also see
None
fs.is_dir()
This function tests whether or not the specified path refers to a directory.
Usage
status = fs.is_dir("path")
Whether or not the given path is a directory (true or false)
The path of the file system entry to test
Details
The file system path may be absolute or relative to the current working system path.
Example 1
print("Is directory: ", fs.is_dir("/usb1/"))
Because /usb1/ is always the root directory of an inserted flash drive, you can use this command to verify that
USB flash drive is inserted.
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.