Find Method

Find the specified file or files in the current package and return them in a PackageFiles collection.

Syntax

object.Find [filename] [, platform] [, options]

The Find method syntax has the following parts:

Part Description
object An object expression that evaluates to a Package object.
filename A string which specifies the name of the file to search for in the current package. This parameter is optional, and if omitted, all files in the package are returned.
platform A numeric value which specifies which platform specific files should be returned. This parameter is optional, and if omitted, defaults to the current platform.
options A numeric value which specifies one or more options for searching the package. This parameter is optional.

Settings

The settings for the platform parameter are:

Constant Description
apDefaultPlatform Specifies the default operating system platform. This specifies that only those files which are targeted for the current platform should be returned in the collection.
apPlatformWin95 The files may be applied to a system running Windows 95.
apPlatformWin98 The files may be applied to a system running Windows 98.
apPlatformWinME The files may be applied to a system running Windows ME.
apPlatformWinNT40 The files may be applied to a system running Windows NT 4.0.
apPlatformWin2000 The files may be applied to a system running Windows 2000.
apPlatformWinXP The files may be applied to a system running Windows XP.
apPlatformWin2003 The files may be applied to a system running Windows Server 2003.
apPlatformWin32 The files may be applied to any 32-bit version of the Windows operating system.
apPlatformWin9X The files may be applied to any system running Windows 95, Windows 98 or Windows ME. They will not be applied on a system running Windows NT, Windows 2000 or Windows XP.
apPlatformWinNT The files may be applied to any system running Windows NT, Windows 2000 or Windows XP. They will not be applied on a system running Windows 95, Windows 98 or Windows ME.
apPlatformWindows The files may be applied to any system running any version of Microsoft Windows.

The settings for the options parameter are:

Constant Description
apRecursiveFind Search recursively through the package, looking for matches in the specified directory as well as all subdirectories.

Remarks

Wildcards and directory names may be specified in the filename parameter to match multiple files. To search the entire package for a given file, the apRecursiveFind option should be specified, and the filename parameter should not include a directory as part of the file name.

You may combine one or more platform values together using a bitwise Or operator. It is recommended that you use the Or operator rather than addition, since addition can have unexpected results.

If the filename parameter is omitted and a platform is specified, only those files which are targeted for the specified platform are returned in the collection.

Example

Dim Files As PackageFiles
Dim File As PackageFile

Set Files = Package1.Find("*.exe", , apRecursiveFind)

For Each File In Files
    If File.FileName = strFileName Then
        ' Do something with the file stored in the package
    End If
Next

See Also

Files Property, Platform Property