get
Description
Retrieves a specified version of a file or files (via search).
Syntax
get (-filePath <path> | -id <id> | -search <query>) [-version <number-or-revision>] [-directory <folder>] [-newName <filename>] [-getoptions <flags>] [-recursive]
Use -id as an alternative to -filePath for the same operand. A required target still needs one selector, even though each alternative is optional individually. See File IDs and paths for selection rules and command-specific exceptions.
Parameters
| Parameter | Alias | Required | Description |
|---|---|---|---|
-search |
-s |
No | The search operation to use. |
-recursive |
No | When used with search, includes files in subfolders. |
|
-filePath |
-f |
No | The file(s) to retrieve. This is the default parameter. |
-version |
-ver |
No | Numeric version or revision label to retrieve. Negative numbers count back from each file’s latest version. For a file at version 8, -1 retrieves version 7. A result of zero or less requests 0, which retrieves the latest version. |
-directory |
No | Folder where to deposit the file. Can be outside vault. Do not end with \. If not specified, file is cached in its folder. | |
-newName |
No | Filename for the retrieved copy, including the extension. Accepts a filename or an expression. | |
-getoptions |
No | . Allows you to cache references as well: | |
-id |
No | Positive PDM file ID instead of -filePath, identifying the same file that -filePath describes (including a macro, input CSV or existing output file). Requires a connected vault. Shared files with multiple locations require an exact -filePath. Resolving the ID itself does not download, check out or check in the file; the requested command still performs its normal operation. |
Parameter values
| Option Name (CLI) | Description |
|---|---|
| Simple | Retrieves the file with no additional options applied. |
| MakeReadOnly | Marks the retrieved file as read-only in the local cache. |
| DisableRefresh | Does not refresh File Explorer after the file is retrieved. |
| RefsOnlyMissing | Retrieves only referenced files that are not already present on the local hard disk. |
| RefsVerLatest | Retrieves the latest versions of referenced files that the user has permission to see, instead of the attached (as-built) versions used when the file was checked in. |
| RefsOverwriteLocked | Retrieves referenced files even if they are checked out and overwrites local changes; warning: any previous modifications to checked-out files will be lost. |
| ForPreview | Retrieves only referenced files required for SOLIDWORKS PDM preview when retrieving the referencing file. |
Examples
get -filePath "file1.sldprt" -Version 2
To retrieve the previous version of a file whose latest version is 8, use get -id 42 -version -1. This retrieves version 7. With -search, each matching file counts back from its own latest version.
Retrieve revision B under a different filename in an existing destination folder:
get -filePath "Bracket.slddrw" -version "B" -directory "C:\Exports" -newName "Bracket Rev B.slddrw"
To use a name calculated earlier in the script, pass -newName "${global.CopyName}". The vault source keeps its original name.
Remarks
- The
searchparameter searches the current directory and does not drill down. The search query is a PDM one, so you can use%for wildcard.
Search results report
Add -csv "C:\Reports\results.csv" when using -search to save operation results. The first columns are file ID, parent folder ID, file name and output, followed by status and error details. The report folder must exist. New vault reports are added to PDM; existing vault reports must be checked out by you on this computer and remain checked out. External reports are replaced. See CSV operation reports for command-specific outcomes.