|
Create a package file based on the differences between the
files in a reference directory and a directory which contains updated versions of those
files.
Syntax
object.Create [oldfiles]
[, newfiles] [, directory] [, exclude] [, options]
The Create 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 creating 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 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 create. If this property is not set, a temporary
package file will be created and the FileName property will be set to the
name of that file. Note that if a package with the same file name already exists, it will
be overwritten. If you wish to protect the package with a password, the Password
property must be set before the Create 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
'
' Create a package file, specifying that missing files should be
' ignored and this is a partial update (so no files will be
' removed from the target system)
'
Package1.FileName = strPackageFile
Package1.Password = strPassword
Package1.Options = apIgnoreMissing
nCreateOptions = apRecursiveUpdate Or apPartialUpdate
On Error Resume Next: Err.Clear
Package1.Create strOldFiles, strNewFiles, , , nCreateOptions
If Err.Number Then
MsgBox Err.Description
Exit Sub
End If
See Also
FileName Property,
Options Property, Password
Property, Progress Event
|
|