DIAdem API Reference

Command: DirLstWrite

  • Updated2023-02-21
  • 4 minute(s) read

Display all  Hide all

Generates a list with filenames. The command does not support Unicode filenames. Use the DirListGet command instead.

ReturnValue = DirLstWrite(DirSearchPath, DirSearchName, DirSortType, FileLstName, FileLstMode, [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.
FileLstName Specifies the path and the name of the ASCII file that DIAdem writes the filenames into.
FileLstMode Specifies whether DIAdem overwrites the contents of the ASCII file or whether DIAdem appends new rows to the ASCII file.
[FileLstFilter] Specifies the information that DIAdem saves. The default value of the FileLstFilter variable is onlyFilenames.

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. If you use the return value, you do not have to specify the parameters FileLstName and FileLstMode.
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.
Note  You can use the ASCII file created with the DirLstWrite command as a list file for serial evaluation.

Examples

The following example searches for all the files from the NAVIGATOR user folder, that have names starting with Demo. DIAdem sorts the list according to filename, and returns the complete path, the filename, and the filename extensions.

VBScriptPython

 

Dim vFoundFiles, iCount, strAll
vFoundFiles =  DirLstWrite(DataReadPath, "Demo*.*", "filename", , 0, "FullFilenames")
If IsArray(vFoundFiles) Then
  For iCount = 0 to Ubound(vFoundFiles)
    strAll =  strAll & vFoundFiles(iCount) & VBCrLf
  Next
  MsgBoxDisp strAll
End If

Related Topics

Command: DataFileDelete | Command: DataFileLstGet | Command: DataFileMove | Command: DataFileRename | Command: FileAttrClear | Command: FileAttrSet | Command: FileClose | Command: FileCloseAll | Command: FileCopy | Command: FileDateSet | Command: FileDelete | Command: FileMove | Command: FileOpen | Command: FileRename | Function: DataFileSize