Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Command: DirListGet

DIAdem 2011 Help

Edition Date: July 2011

Part Number: 370859J-01

»View Product Info

Generates a list with filenames.

ReturnValue = DirListGet(DirSearchPath, DirSearchName, DirSortType, [FileLstFilter])

Input Parameters

DirSearchPath Specifies on which drive and in which folder DIAdem searches for the files.
DirSearchName Specifies the name of the file that DIAdem searches for in the specified path.
DirSortType Specifies wether DIAdem sorts the found list.
Enumeration variable
Enumeration variable with the following selection terms
Script Term Interface Term, Explanation
"filename"
Filename
"extension"
Filename Extension
"filesize"
File size
"Date/Time"
Date/Time
[FileLstFilter] Specifies the information that DIAdem saves. By default the FileLstFilter variable contains the value onlyFilenames.
Enumeration variable
Enumeration variable with the following selection terms
Script Term Interface Term, Explanation
"onlyFilenames"
Only filenames
"onlyDirectorynames"
Only path names
"Filenames"
Filenames and filename extensions
"FullFilenames"
Complete filenames
"FullFilenamesRecursive"
Recursive after complete filenames
"DirectorynamesRecursive"
Recursive after path names

Return Parameters

ReturnValue The return value is a Variant variable type. The return value contains a zero-based array with the entries that the command has found.
You cannot use return values in AUT scripts. Refer to Advantages of VBS Scripts Compared to AUT Scripts for further information on the use of VBS scripts and the automatic conversion of AUT scripts.
Note  Sorting with the DirSortType variable is case sensitive. For example, if DIAdem finds the filenames FILE.txt and company.txt, the program enters the filename in uppercase before the filename in lowercase.

Example

The following example generates a list of all files in the folder C:\ and outputs the list as a message. DIAdem also writes the list into a file.

Dim vFoundFiles, iCount, strAll, hFile
vFoundFiles = DirListGet("C:\", "*.*", "filename", "FullFilenames")
If IsArray(vFoundFiles) Then
  For iCount = Lbound(vFoundFiles) to Ubound(vFoundFiles)
    strAll = strAll & vFoundFiles(iCount) & VBCrLf
  Next
  Call MsgBoxDisp(strAll)
  hFile=TextFileOpen(ScriptWritePath & "FileList.asc", TfCreate OR TfUnicode OR TfWrite OR TfDenyNone)
  Call TextFileWriteln(hFile, strAll)
  Call TextFileClose(hFile)
End If


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit