ProcessMoveBatchesEx

Move selected batches to folder specified in the parameter.

Member of namespace

Maintenance Manager

Syntax

bool ProcessMoveBatchesEx (string pathTo, bool moveSubFolders, bool preserveEngineDBPaths, bool continueOnError)

Parameters

pathTo
Type: string
moveSubFolders
Type: bool
preserveEngineDBPaths
Type: bool
continueOnError
Type: bool

Parameters

  • pathTo: The destination directory for the batches. Smart parameters are supported.
  • moveSubFolders: True moves any subfolders within batch directories regardless of creation source. This parameter is required if the batches contain subfolders or else operations, including database updates, will fail.
  • preserveEngineDBPaths: True preserves original batch directory paths inside the engine database.
  • continueOnError: True continues processing if any single batch fails to be moved with non-fatal error.

Returns

True, if the batches are successfully moved. Otherwise, False.

Level

Any level.

Details

Using the results from a previous query that is performed by Maintenance Manager actions, the selected batches are moved to the specified destination directory. A previous query must first be run to identify the batches to move to the new directory. The destination directory must exist. The database connection is closed by this action.

If you are moving batches from one location to another and also moving database records from one database to another, move the batches first. The movement of the database records must be done last.

Examples

The following example runs a query to select all batches from station "1" where the Job ID does not equal "Demo Job", then moves the batches to a directory called "My Old Batches".

QuerySetStation("1")
QuerySetJobID("!Demo Job")
ProcessRunSqlQuery("")
ProcessMoveBatchesEx("@STRING(C:\My Old Batches\),false,false,false")       

This following example selects the same set of batches but it uses a Smart parameter to obtain the full path to directory from the Application Service. A key called BatchArchiveDirectory must exist in the Application Service. If these rules are used for multiple applications, each application can have a unique definition of this value within the Application Service, making these rules flexible.

One benefit of this approach is that in an environment where there is a test system and a production system, each system will have unique values stored in the Application Service. Each of the environments can have a different physical directory specified within the Application Service, allowing the rules in each system to remain identical.

QuerySetStation("1")
QuerySetJobID("!Demo Job")
ProcessRunSqlQuery("")
ProcessMoveBatchesEx("@APPPATH(BatchArchiveDirectory),false,false,false")