Use
delete to delete all objects that satisfy the
WHERE clause. The syntax of the where clause is identical to
select,
update or
delete, and is fully described in the
select command section. A check-in change package is created that records the set of items that were deleted. The items are deleted in a server transaction. As a result, either all items are deleted (and the transaction succeeds) or not a single item is deleted and the transaction fails. If the transaction fails, it is rolled back. Values that contain spaces should be enclosed in double quotes. This command has been modeled on the standard SQL
DELETE syntax.
Syntax
The syntax for this command is:
stcmd{Ex} delete type {local} {output* | {propertyName,...} |
filter='myFilter' into "outputFilePath" {separator 'fieldSeparator'}}
where {{ attached-label = 'labelName' } | { query = 'myquery' } |
propertyName relation value and/or propertyName relation value and/or...}
{for} {folder = 'myfolder' {recurse} or folder = 'myfolderhierarchy'
{recurse}
or folder = . {recurse}} or ...}
type { File | Folder | ChangeRequest | Requirement | Task | Topic |
CustomComponentTypeName | Trace | ChangePackage }
[–epwdfile “passwordfilepat”]
[-p "userName:password@hostName:endpoint/projectName/[viewName/][folderHierarchy/]"]
- Parameter
- Description
- type
- Specifies the
StarTeam item type by name. Types are mutually exclusive.
- myFilter
- Specifies a filter by name, whose properties are written to the output file.
- myFolder
-
Specifies the
StarTeam folder name in the current view.
If there are multiple folders with the same name, the command performs the action on all folders with that name.
- myFolderHierarchy
-
Specifies the folder hierarchy in the "/" format.
Start from the root folder and end in a branch folder. For example:
/StarDraw/SourceCode/On-line Help/.
- output
- Turns on logging of the command to a log file specified by
INTO.
The
INSERT,
DELETE, and
UPDATE commands log the selected properties of the inserted items to a log file. The property values are separated by the specified
fieldSeparator, or "|" if a separator is not specified.
- recurse
- Designates all descendants from the folder specified.
- .
-
Implies the current working folder, requiring the tool to find
StarTeam folders with paths mapping to the current working folder.
The Command processor must be running inside the
StarTeam folder hierarchy.
- query='myQuery'
-
Specifies the saved
StarTeam query name for the type.
It acts as the equivalent of a compound where clause of a SQL statement, such as combinations of relations and operators.
If no query name is specified, the command performs the action on all objects of the type.
- -p
- Indicates the view or folder to be used. It also provides the user name and password needed to access the server.
-p is retained for backward compatibility. Commands using
-p continue to work, but are stateless. Each command opens a connection, executes the command syntax, and closes the connection. (New command line scripts may take advantage of the command line's stateful nature. See
connect and
set for examples. Old scripts may be migrated to the new command line syntax.) Stateless commands cause more client server traffic than stateful commands.
-
Note: If the clear text password contains the
@ or the
: symbols, then it cannot be specified through
-p using the syntax
username:password@host:port. The
@ or
:symbols will conflict with the syntax and cause the command to fail. In general, passwords with special characters in them such as
@, :, ,, must be stored in the password file using the
store-password command. Additionally, the password, when specified for storage in the encrypted file, must be quoted. For example:
stcmd store-password -password "foo@bar" -epwdfile c:\tmp\pwdfl. Passwords stored in an encrypted password file can be used in conjunction with
-p or the
connect command as documented.
The full syntax is:
stcmd -p "userName:password@hostName:endpoint/projectName/[viewName/][folderHierarchy/]"
For example:
stcmd -p “bsmith:rocketfive@orion:49201/StarDraw/StarDraw/SourceCode/”
- If the user name is omitted, the current user name is used.
- If the password is omitted, the user is prompted to enter the password. When the user types a password, the characters are not displayed on the screen.
- If the host name is omitted, the default is localhost.
- Entering an endpoint (port number) is required. The default is 1024.
- The project name is always required.
- A view hierarchy should be used to identify the view. Use the colon (:) as a delimiter between view names. The view hierarchy should always include the root view. For example, "StarDraw:Release 4:Service Packs" indicates that the view to be used is the
Service Packs view, which is a child of the
Release 4 view and a grandchild of the
StarDraw root view. If the view name is omitted, the root view is used. If the view is the only view in that project with that name, you can use only the view name. Doing this is not recommended, however, because another view with that name could be created at a later date.
- A folder hierarchy should be used to identify the folder. Use the forward slash (/) as a delimiter between folder names. The folder hierarchy never includes the root folder. Omit the folder hierarchy if the file is in the view’s root folder. For example, if the root folder of the view is
StarDraw, and the hierarchy to your files is
StarDraw/SourceCode/Client, use only "SourceCode/Client".
- -epwdfile
-
The
-epwdfile keyword specifies the path to the file that contains the encrypted password. Like
-pwdfile ,
-epwdfile replaces the password being used as part of the
-p or
-s option, preventing others from seeing the user's password on the command line. The full syntax is:
-epwdfile "filePath" .
The
-pwdfile is supported for backward compatibility. Un-encrypted passwords stored using older versions of
stcmd are read. However, passwords cannot be stored to files using
-pwdfile anymore.
Note: When
-epwdfile is used, a password should not be specified as part of the
-p or
-sparameter.
In this case, the syntax of
-p or
-s reduces to
-p "username@hostname:port/... -epwdfile "fullyQualifiedPathToPasswordFile"".
The following is the syntax of the commands that can be used to store an encrypted password.
Use the following syntax to be prompted for the password that will be encrypted and stored in a file.
stcmd store-password -epwdfile "filePath"
Use the following syntax to include the encrypted password in the command as clear text.
Note: This action does not access the network with the clear value.
stcmd store-password -epwdfile "filePath" -password "password"
After an encrypted password is stored, other
stcmd commands can specify
-epwdfile "filePath"' as parameters. For example:
stcmd delete-local -p "JMarsh@Orion:1024/StarDraw/StarDraw/SourceCode" -epwdfile "C:\estuff\myfile.txt" -filter "N" "*"
Important:
If
-p or
-s and
-epwdfile are used together, then the parameter
:password must be omitted from
-p. For example:
-p user@hostname:port/projectName.viewName -epwdfile "pathToPasswordFile"
Example
The following example deletes all change requests with an open status from the
StarDraw project
StarDraw view.
stcmd connect Administrator:Administrator@localhost:49201
stcmd set project = ‘StarDraw’ view = ‘StarDraw’
stcmd delete changerequest where query = "Status = Open" disconnect