ID Number: Q84835
1.00
WINDOWS
Summary:
There is no built-in function in Test Basic to detect whether or not a
subdirectory exists. However, if you know what subdirectories might
exist, you can check for the NUL file in a given subdirectory using
the EXISTS function. This method works consistently only on local
subdirectories, and may not work correctly for drives accessed through
a network.
This information applies to Microsoft Test for Windows version 1.0.
More Information:
The following code checks to see if the subdirectory \DOS exists by
checking for the existence of the NUL file. (The NUL file is created
when a subdirectory is created, and is subsequently present in all
MS-DOS subdirectories.)
If EXISTS ("C:\DOS\NUL") Then
Print "Subdirectory exists."
Else
Print "Subdirectory does not exist."
End If
To check for the presence of other subdirectories, put each name into
the path used with the EXISTS function. For example, to check for the
presence of a subdirectory named TEMP, you would use the following:
If EXISTS ("C:\TEMP\NUL") Then...
Because this method requires the name of the subdirectory to be
checked, it will not work if the subdirectory names are not known.
This method works on all local MS-DOS subdirectories, and may work
sporadically on network subdirectories.
Additional reference words: 1.00