Customizing a Check File/Folder Attributes Rule

InstallAnywhere 2020

The Check File/Folder Attributes rule examines key attributes of a given file or folder. With this rule, you can do the following:

Specify a file or folder to check
Determine if that file or folder exists
Determine if that file is empty
Determine whether the given path points to a file or a folder
Determine if that file or folder is readable, writable, or both readable and writable
Determine if that file or folder is idle or in use

You can choose to test one or more of these attributes when you configure the Check File/Folder Attributes rule, but be aware that all selected attributes must evaluate to true for the rule to produce a true result.

To customize a Check File/Folder Attributes rule:

1. In the File/Folder Path text box, enter the location of the file or folder you want to evaluate.

Note • The File/Folder Path can include Magic Folders and other InstallAnywhere variables.

2. Set rule criteria.

Example: Verifying a File Exists Before Running the Installer

For many silent installations, the installer requires an installer properties file to provide settings that govern the installation. In this example, we'll use a Check File/Folder Attributes rule to prevent the installer from running unless the response file (installer.properties) exists in the same directory as the installer.

To verify a file exists before running the installer:

1. In the Advanced Designer, on the Project page, click Installer Rules. The Installer Rules view opens.
2. Click the Add Rule button. The Choose a Rule/Expression dialog box opens.
3. Click the Check File/Folder Attributes action, and then click the Add button. InstallAnywhere adds the rule to the rules list.
4. In the File/Folder Path setting, enter the following value:

$INSTALLER_LAUNCH_DIR$/installer.properties

5. Leave the default rule criteria. (Perform only if the file/folder already exists and Perform only if the file/folder is a file.)

Note • For file- and folder-related install actions in the Install sequence, InstallAnywhere includes a separate Check if File/Folder Exists rule. This rule is not available in Installer Rules view on the Project page, but you can add it via the customizer’s Rules tab in the Install view.

See Also