Command: DirListGet

DIAdem 2018 Help


Edition Date: June 2018
Part Number: 370858P-01
View Product Info

DOWNLOAD (Windows Only)


DIAdem 2012 Help
DIAdem 2014 Help
DIAdem 2015 Help
DIAdem 2017 Help
DIAdem 2018 Help
DIAdem 2019 Help

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 how DIAdem sorts the list it finds.
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. The default value of the FileLstFilter variable is 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.
Note  Sorting with the DirSortType variable is case sensitive. Usually sorts in ascending order. For example, if DIAdem finds the filenames FILE.txt and company.txt, the program enters the filename in uppercase before the filename in lowercase. If you sort by date/time, DIAdem first finds the newest files.

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", eTextFileAttributeCreate OR eTextFileAttributeUnicode OR eTextFileAttributeWrite OR eTextFileAttributeDenyNone)
  Call TextFileWriteln(hFile, strAll)
  Call TextFileClose(hFile)
End If

WAS THIS ARTICLE HELPFUL?

Not Helpful