Purge Command Line Parameters

As an alternative to using the GUI, you can use the command line to purge asset versions.

The command line program is named STWPurge.exe and is located in: \Silk\SilkTest\ng\gui\.

Parameter Syntax Example Description
Username

u

username

-u admin

/username JohnSmith

Specifies the name of the user authorized to connect to the database. This parameter is required.

Password

p

password

-p admin123

/password admin123

Specifies the case sensitive password of the user authorized to connect to the database. This parameter is required unless the password is Nothing.

DSN

d

dsn

-d mydsn

/dsn mydsn

Specifies the name of the Data Source Name (DSN) used to connect to the database. This parameter is optional. If omitted, the default DSN is used.

Asset Types

s

assettypes

-s visualtest script

/assettypes visualtest

Specifies the asset type(s) from which to delete asset versions. This parameter is optional. If omitted, all asset types are specified. This parameter accepts the following values (syntax is indicated in brackets; multiple values are separated by a space) :

  • Visual test [visualtest]
  • Object Map [objectmap]
  • Result [result]
  • Active Data [activedata]
  • .NET scripts [script]
Projects

r

prj

projects

-r commonprojectA

/projects common

Specifies the project, the asset type, or the individual asset from which to delete asset versions. This parameter is optional. If omitted, all projects are specified. Multiple entries must be separated by a space. Entries containing the caret symbol (^) must be enclosed in quotes.

The following sample code shows how you can use the projects parameter to purge old asset versions from an individual visual test named Login:
-projects Common.VisualTest.Login
The following sample code shows how you can use the projects parameter to purge old asset versions from all active data assets in the project MyProject:
-projects MyProject.ActiveData
When specifying asset types or individual assets with the projects parameter, you cannot specify the assettypes parameter. However, you can use the two parameters together when specifying projects. For example:
-projects Common -assettypes script
Purge by Count

pc

purgebycount

-pc 10

/purgebycount

Deletes older asset versions in excess of the number specified. Either this parameter or the Purge by Date parameter is required. The use of both parameters is not permitted. The minimum number of versions you can keep is 1 and the maximum number of versions is 32767. You cannot delete the active version of an asset. This parameter accepts a single numerical value. For example, if you specify 10, then the latest ten versions of an asset are retained and any older versions are deleted.

Note: All actual checks are kept during purge and are deleted when results are deleted. Expected checks that are in use by results are also not deleted. After a purge, more expected checks that specified might be retained. For example, if 5 versions of an expected check are referenced by test results and you want to leave only 3 versions for each asset after the purge, all 5 versions of the check that are referenced by results are retained.
Purge by Date

pd

purgebydate

-pd 2011-03-28

/purgebydate 2012-03-28

Deletes asset versions modified before the specified date. Either this parameter or the Purge by Count parameter is required. The use of both parameters is not permitted. This parameter accepts a date between 1970-01-01 and 3000-12-31 in the following date format: [YYYY-MM-DD].

Note: All actual checks are kept during purge and are deleted when results are deleted. Expected checks that are in use by results are also not deleted. This might lead to situations where expected checks are retained which are older than the date you have specified.
Info Mode

i

info

-i silent

/info verbose

Sets the type of information to display during the execution of the program. This parameter is optional. If omitted, the default mode of "Normal" is used. This parameter accepts the following values (syntax is indicated in brackets):

Normal [n|normal]
Outputs all errors and general information.
Silent [s|silent]
Outputs only errors that stop execution.
Verbose [v|verbose]
Outputs all warnings, errors, and general information.
Prompt

o

prompt

-o /prompt

Displays a confirmation message box after displaying the asset purge report. This parameter is optional.

Help

h

?

help

-h /help

Displays the help content and ignores all other parameters except for Color Mode.

Example 1

This example shows how to purge all results in the Common project, leaving five versions of each result:
stwpurge /dsn SilkTest /username admin /password admin /purgebycount 5 /projects Common /assettypes result

Example 2

This example shows how to purge all versions of the visual test LoginTest that were created before December 31, 2016:
stwpurge /dsn SilkTest /username admin /password admin /purgebydate 2016-12-31 /projects Common.VisualTest.LoginTest