Function File Names Class

FindFileUpwards

Find the first file named vPath by starting in some directory and searching up the directory hierarchy until the drive root is reached. For example, search for "FTPINFO.TXT" in "C: \ENTISOFT\TOOLS", "C:\ENTISOFT" and "C:\" Return empty string if the named file was not found.

Signature (Visual Basic / VBA)

Public Function FindFileUpwards( _
    ByVal vPath As Variant _
    , Optional ByVal vAttributes As Variant _
    ) As Variant

Code Example

    ? FindFileUpwards("C:\Entisoft\Autoexec.Bat")
    C:\Autoexec.Bat

Parameters

Parameter Description
vPath Path name that combined the starting directory with the name of the file to be found. Function returns Null if vPath is Null or cannot be fixed-up to a string. For example, specify a path of "C:\Entisoft\Tools\Autoexec.Bat" to start the search for file "Autoexec.Bat" in directory "C:\Entisoft\Tools"
vAttributes One or more of the vb constants vbNormal, vbHidden, vbSystem, vbVolume, and vbDirectory describing the types of files to be included in the search. vAttributes defaults to vbNormal if it is missing or Null or cannot be fixed-up to a number.