Public Function DirToVariantVector( _ ByRef rPathNames() As Variant _ , Optional ByVal vPattern As Variant, Optional ByVal vCompare As Variant _ , Optional ByVal vExprIsLike As Variant _ , Optional ByVal vIncludePath As Variant, Optional ByVal vAbsolutePath As Variant _ , Optional ByVal vSortNames As Variant _ , Optional ByVal vAttributes As Variant, Optional ByVal vRecurseSubDirs As Variant _ ) As Boolean
Assuming Dim avarFiles() As Variant for example DirToVariantVector(avarFiles(), "C:\*.*") = True leaves LBound(avarFiles) = 0 UBound(avarFiles) = 3 IsEmpty(avarFiles(0)) = True avarFiles(1) = "COMMAND.COM" avarFiles(2) = "AUTOEXEC.BAT" avarFiles(3) = "CONFIG.SYS"See also:
DirToVariantVectorSample Subroutine MakePathAbsolute Function IsPathRelative Function PathAndNamesStringToVariantVector Function Dir$ Function (Visual Basic)rPathName: Dynamic, one-dimensional array of Variants that will receive the file name(s) from this function. rPathName will be re-dimensioned from 0 (zero) to the number of files found, and the file names are placed in elements 1 (one) through the number found.
vPattern: Directory name, file name, and/or file pattern describing file names to be returned.
vPattern defaults to "*.*" if it is missing or Null or cannot be fixed-up to a string.
vCompare: Collating sequence/sort order used to sort the file names when the vSortNames is True.
vCompare defaults to the Text sort order (vbTextCompare) if it is missing or Null or cannot be fixed-up to a number.
vExprIsLike: True if the file name pattern vPattern should be interpreted as a Visual Basic LIKE pattern. False if vPattern contains only DOS/Windows file name wildcards or no wildcards at all.
vExprIsLike defaults to False (vPattern is assumed to contain only DOS/Windows wildcards, if any) when it is missing or Null or cannot be fixed-up to a number.
Performance: Function can take significantly longer when vExprLike is True because it must examine every file in the directory using the VB Like operator.
vIncludePath: True if the path name (drive and directory name) portion of vPattern should be appended to each file name returned in the array. False if only the file prefix and extension portions of the file name should be returned.
vIncludePath defaults to False (so that this function mimics the VB Dir$ function) if it is missing or Null or cannot be fixed-up to a number.
vAbsolutePath: When vIncludePath is True, this argument determines if relative paths should be converted to the corresponding absolute path. True if all file names whould be made absolute; False if they should be left relative to the vPattern. This argument is ignored when vIncludePath is False.
vAbsolutePath defaults to False when it is missing or Null or cannot be fixed-up to a number.
Definition: Absolute paths are those that specify a direct path to a file from the root of some named drive. All other path names are relative. See the IsPathRelative and MakePathAbsolute functions for more information.
vSortNames: True if the file names should be sorted before being returned.
vSortNames defaults to False (like VB Dir$ function) if it is missing or Null or cannot be fixed-up to a number.
vAttributes: One or more of the vb constants vbNormal, vbHidden, vbSystem, vbVolume, and vbDirectory describing the types of files whose names will be returned.
vAttributes defaults to vbNormal if it is missing or Null or cannot be fixed-up to a number.
vRecurseSubDirs: True if all sub-directories matching the wildcard vPattern (and all of their sub-directories, etc.) should be searched. False if the function should only return the names of files in the directory specified by vPattern.
vRecurseSubDirs defaults to False if it is missing or Null or cannot be fixed-up to a number.
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.