Update Method

Update the contents of the current package.

Syntax

object.Update [oldfiles] [, newfiles] [, directory] [, exclude] [, options]

The Update method syntax has the following parts:

Part Description
object An object expression that evaluates to a Package object.
oldfiles A string which specifies the name of the directory which contains the original version of the files to be stored in the package. This parameter is optional.
newfiles A string which specifies the name of the directory which contains the updated version of the files to be stored in the package. This parameter is optional.
directory A string which specifies the name of the installation directory on the target system. This parameter is optional.
exclude A string which specifies one or more files which are to be excluded from the package. Wildcards may be used, and multiple files may be specified by separating them with semicolons. This parameter is optional.
options A numeric value which specifies one or more options for updating the package. These options are specific to creating and updating packages, and are separate from those options specified in the Options parameter. This parameter is optional.

Settings

The settings for the options parameter are:

Constant Description
apRecursiveUpdate The reference and update directories should be recursively scanned for new, modified and deleted files. If this update option is not used, only those files in the specified directory will be included in the package. If the option parameter is omitted from the method, this option is selected by default.
apPartialUpdate This is a partial update, therefore files missing from the the new file directory should not be marked for removal from the target system.
apAlwaysReplace Always replace changed files instead of creating a patch. The file on the target system will always be overwritten, regardless of its previous version.

Remarks

The FileName property should be set to the name of the package file that you wish to update. If the package is protected with a password, the Password property must be set before the Update method is called.

If the oldfiles parameter is omitted, then those files in the directory specified by the newfiles parameter will be added to the package and will replace any existing files on the target system. If the oldfiles parameter is specified, but the newfiles parameter is omitted, then those files will be marked for deletion from the target system. If both parameters are omitted, an empty package file is created.

If you wish to include multiple versions of a file, or files with the same names targeted for different operating systems, you must set the Options property and specify the apMultipleVersions option before calling this method.

An application method will be associated with each file that is added to the package. The possible application methods are: Create, Replace, Modify, and Delete. An application method for a given file is determined by this method through comparison of the files referred to by the oldfiles and newfiles specifications.

Example

Package1.FileName = strPackageFile
Package1.Password = strPassword

On Error Resume Next: Err.Clear
Package1.Update strOldFiles, strNewFiles

If Err.Number Then
   MsgBox Err.Description
   Exit Sub
End If

See Also

FileName Property, Options Property, Password Property