FileFind - method of object Pm

Finding out files and folders in the specified path.
FileFind(sPath As String, sName As String, nAttr As Long) As Variant
FoundFiles = Pm.FileFind(sPath, sName, nAttr)
sPath(String) Path where to find the files.

It is recommended to use the PROMOTIC path syntax - see PROMOTIC path to files and folders.

sName(String) File names that have to be found; wild charactes * and ? can be used
nAttr(Long) Bit attribute. The value is a bit combination :
1 - Don't look in subfolders
2 - Return absolute paths
4 - Find even folders
8 - Find only subfolders; overwrites attribute 4
16 - The output array is sorted by creation time of files
32 - The output array is sorted by file name
64 - The output array is sorted by the file extension
128 - The output array is sorted bottom-up (from the smallest to the biggest = aa, ab, ba, bb, c, d ...). Othewise the sorting is top-down (from the biggest to the smallest = zz, zy, yz, yy, x, w, ...). Value 0 means to find only files, not folders.
256 - File names will be returned without extension
512 - Sorts the output array by the last write time of the files
Return Values:
Method always returns the items array of the String type. If only one file has been found, the array has only one item. If no file has been found, the array has no items (upper index UBound=-1).
Relative path (if nAttr AND 4 is not set) refers to the beginning of the search (file names are added to files in subfolders, for example "file.ini", "DATA/file.dat").
This method is not functional for Web panels.
Finding INI files in the application folder, their listing without looking in subfolders and sorting by names bottom-up. It returns absolute paths to the files.
Dim aFiles, i
aFiles = Pm.FileFind("#app:", "*.INI", 1+2+32+128)
For i=0 To UBound(aFiles)
  Pm.Debug aFiles(i)
Finding app.txt file in the application folder. It returns absolute path to the file.
Dim aFile
aFile = Pm.FileFind("#app:", "App.txt", 1+2)
If UBound(aFile)<>-1 Then
  Pm.Debug aFile(0)    'File found.
End If
PROMOTIC 8.3.19 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
- Pm
- Abs
- Cos
- E
- Exp
- FileFind
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice