Supersede Rules
The Supersede utility uses configurable rules to specify file superseding and archiving behaviour.
Example
"Rules": [
{
"Pattern": "(?<SheetNumber>.+) - (?<SheetName>.+) \\((?<Revision>.+)\\)",
"Extensions": [ ".pdf" ],
"Copy": {
"Enabled": true,
"Path": "..\\Current",
"PathBase": "Default"
},
"Supersede": {
"Enabled": true,
"MatchFields": ["SheetNumber"],
"RevisionField": "Revision",
"Mode": "Move",
"Path": "..\\Superseded",
"PathBase": "Default"
}
}
]
Pattern
A Rule specifies a single Pattern
that will be used to match files. This pattern is a regular expression.
Extensions
A Rule may optionally specify a set of file extensions to be matched. If one or more Extensions
are specified then the utility will first match files to the listed extensions and then attempt to match the specified Pattern
to the part of the filename without the extension.
Copy
The Copy
object specifies the configuration for copying matched files to another location. Copying occurs before superseded files are archived.
Copy
is optional, if it isn’t specified then it’s value will be determined from any applicable higher level configuration.
Copy
is typically used in scenarios where files are exported directly to a location where they will remain even after they have been superseded, and the Supersede utility is used to Copy
those files to a separate current folder that contains the current revision of each file.
Enabled
Specifies whether copying is enabled for this rule.
Enabled
is optional, if it isn’t specified then it’s value will be determined from any applicable higher level configuration.
Path
Specifies the folder where files are to be copied to.
Path
is optional, if it isn’t specified then it’s value will be determined from any applicable higher level configuration.
PathBase
Specifies how a relative Path
will be resolved.
Value | Meaning |
---|---|
| Resolves a relative |
| Resolves a relative |
PathBase
is optional, if not present then Default
will be used.
PathBase
is only relevant in a folder specific .supersed-config
file. It has no meaning in an application Supersede.json
configuration file.
Supersede
The Supersede
object specifies the configuration for matching and archiving superseded files. Some properties can be omitted from the configuration in order to inherit values from any applicable higher level configuration.
See configuring default behaviour and folder specific configuration for more information.
Enabled
Specifies whether superseding is enabled for this rule.
Enabled
is optional, if it isn’t specified then it’s value will be determined from any applicable higher level configuration.
MatchFields
Specifies which named captures from the Pattern
are used to find superseded files.
If no MatchFields
are specified then all named captures present in the Pattern
will be used. If the Pattern
does not contain any named captures then the utility will be unable to match any superseded files.
RevisionField
Specifies which named capture from the Pattern
will be interpreted as a Revision in order to determine which files are current. If RevisionField
is not specified, the utility will look for a named capture with the name Revision
or Rev
.
If no revision field is found, or the revision cannot be reliably interpreted, then the utility will always assume that the file being processed is newer than all other matching files.
Mode
Specifies what to do with superseded files.
Value | Meaning |
---|---|
| Moves superseded files to the specified |
| Deletes superseded files |
Mode
is optional, if it isn’t specified then it’s value will be determined from any applicable higher level configuration.
Path
Specifies the folder where superseded files should be moved when Mode
is Move
.
Path
is optional, if it isn’t specified then it’s value will be determined from any applicable higher level configuration.
PathBase
Specifies how a relative Path
will be resolved.
Value | Meaning |
---|---|
| Resolves a relative |
| Resolves a relative |
PathBase
is optional, if not present then Default
will be used.