Rules

Rules are a set of Conditions and associated Actions. Each rule basically says, "If these conditions are met, then do this action." One or more conditions may be used in a given rule, and they all must be met in order for the designated action(s) to be taken.

In this topic we use two rules as an example to demonstrate how adding rules work: CheckForLargeFiles and CheckForGiantFiles.

The CheckForLargeFiles rule has the following conditions:

  • ${filename:equals('fileOfInterest')}
  • ${fileSize:toNumber():ge(1048576)}
  • ${fileSize:toNumber():lt(1073741824)}

The associated action for the filename attribute:

  • ${filename}.meg

Taken together, this rule says:

  • If the value of the filename attribute is fileOfInterest, and
  • If the fileSize is greater than or equal to (ge) one megabyte (1,048,576 bytes), and
  • If the fileSize is less than (lt) one gigabyte (1,073,741,824 bytes)
  • Then change the value of the filename attribute by appending ".meg" to the filename.

Continuing with this example, we can add another rule to check for files that are larger than one gigabyte. When we add this second rule, we can use the previous rule as a template, so to speak, by selecting the Expand > Duplicate option for the CheckForLargeFiles rule.

In this example, the CheckForGiantFiles rule has these conditions:

  • ${filename:equals('fileOfInterest')}
  • ${fileSize:toNumber():gt(1073741824)}

Then it has this action for the filename attribute:

  • ${filename}.gig

Taken together, this rule says:

  • If the value of the filename attribute is fileOfInterest, and
  • If the fileSize is greater than (gt) one gigabyte (1,073,741,824 bytes)
  • Then change the value of the filename attribute by appending ".gig" to the filename.