File System Migration Process with Shinydocs Pro Setup and Script Execution
File System Migration
This guide migrates a file share that Shinydocs Pro has crawled into OpenText Content Server, using the ShinySync.cmd script, which runs the Cognitive Toolkit’s Migrate operation.
Prerequisites:
- Shinydocs Pro, with the file share crawled as a source
- The Shinydocs Content Server module, version 1.6.23 or later, installed on Content Server. Download it from Settings > Resources in Control Center.
- Content Server connectivity and credentials
- File share access and read permissions
- RDP access to the Shinydocs Pro server
- Service Account access
- Shinydocs Pro license file, for CLI activation
Shinydocs_Migrate.zip, which contains the script and its files, from Shinydocs- A text editor such as Notepad++ (optional) or Windows’ Notepad
Files and Folders:
Please replace x:\ with your preferred location based on your internal standards.
- x:\Shinydocs and:
- x:\Shinydocs\batchfiles
- x:\Shinydocs\sources
- x:\Shinydocs\queries
- ShinySync.cmd
- contentserver.json in sources folder
- match_all.json in queries folder
Command Line Interface (CLI) Activation:
This should only need to be performed once, or after a new license is issued.
- As the Service Account, open a Command Prompt as an Administrator and…
- Navigate to the Shinydocs Pro ControlCenter folder: (typically,
C:\Program Files\Shinydocs Professional\ControlCenter) - Use the command,
CognitiveToolkit.exe activate -p "<path>"where the path is the location and filename of the license file. - The CLI, Cognitive Toolkit, has been activated.
- Note this folder location for later use as CogFolder in the script.
C:\Program Files\Shinydocs Professional\ControlCenter>CognitiveToolkit.exe activate -p "C:\Shinydocs\license.xml"
License activated.
Activation is saved for the Windows account that ran it, and the Cognitive Toolkit reads the license from that path each time, so keep the license file where it is.
Configuring the Secure Credentials:
- As the Service Account, open a Command Prompt as an Administrator and…
- Navigate to the Shinydocs Pro Control Center folder: (typically,
C:\Program Files\Shinydocs Professional\ControlCenter) - Use the command,
CognitiveToolkit.exe savevalue, to save credentials. - When prompted for the key name, enter a name for the Content Server password, such as
cs-password. When prompted for the value, enter the password. It isn’t shown as you type.
CognitiveToolkit.exe savevalue
Please enter the key name ('q' to quit): cs-password
Please enter the value: ****************
- The credentials will be saved securely into a file called saved-parameters.yaml in the ControlCenter folder.
- To verify the credentials have been stored, display the file with
type saved-parameters.yaml. It lists each name you saved with its encrypted value. Don’t usesavevalue --listwhere others can see your screen: it shows the saved values decrypted. - Only the user that created the credentials can use those credentials. Ensure that credentials are created by the same user, the Service Account, that will be executing the scripts.
- If there is a credentials change, re-run the
savevaluecommand with the same name to overwrite the value.
Deploying the Script:
Please remember to Unblock the zip file, Shinydocs_Migrate.zip, in the file’s properties using File Explorer.
- Unzip the file to x:\Shinydocs

- Navigate to sources, open contentserver.json in a text editor. It should look like this:
JSON
{
"sourceType": "contentserver",
"sourceConnectionSettings": {
"username": "svc-shinydocs",
"password": "~cs-password",
"contentServerUrl": "https://cs.contoso.local/otcs/cs.exe"
}
}
- Update line 4 with the Content Server user name: the name the account signs in with, not a numeric user ID.
- Set line 5 to a tilde (~) followed by the name you saved with
savevalue, for example~cs-password. The tilde tells the Cognitive Toolkit to use the saved, encrypted value. Don’t put the password itself in this file. - Line 6 must be updated to your Content Server’s cs.exe URL.
- Save this file.
- Check that queries\match_all.json contains
{ "match_all": {} }. It selects every item in the source’s index. - Navigate to the batchfiles folder.
- Open the command script, ShinySync.cmd, in your text editor. Its first lines look like this:
@ECHO OFF
:: Shinydocs file share to Content Server migration
:: -----------------------------------------------------------------
SET CogFolder=C:\Program Files\Shinydocs Professional\ControlCenter\
SET homeFolder=C:\Shinydocs
SET threads=16
SET cscrawlthreads=8
:: Specify Fileshare Index
SET indexName=00000000-0000-0000-0000-000000000000
SET pathprefix2remove="\\FS01\Finance"
:: Set Target Content Server Folder Object ID...
SET folderId=123456
SET indexURL=http://localhost:9200
SET csJSON="%homeFolder%\sources\contentserver.json"
SET queryFile="%homeFolder%\queries\match_all.json"
:: -----------------------------------------------------------------
SET WorkingDir=%~dp0
ECHO Working Folder: %WorkingDir%
- The variables we need to set are in this first section:
- Line 5, CogFolder, is the location of the Cognitive Toolkit, as noted above.
- Line 6 is the location of these scripts, for example C:\Shinydocs.
- Line 11 is the source’s index name. In Control Center, open the source and copy the Name under Index information.
- Line 13 is the full path to the folder that was crawled. The folders below it are recreated in Content Server.
- Line 16 is the node ID of the target folder in Content Server. The folder must exist. It doesn’t need to be empty, but this is preferred on first execution. Subfolders are created under it.
- Line 18 is the search engine URL. The default should not need to be changed.
- Line 19 is the location of the file, contentserver.json, and is required.
- Line 20 is the location of the default filter query, match_all.json, and is required.
Unless directed, there’s no need to modify the command script beyond line 20.
Running the Script:
- Open a Command Prompt as the Service Account
- Navigate to the batchFiles folder, x:\Shinydocs\batchfiles
- Enter the command:
ShinySync.cmd - The script will begin the migration. It runs Migrate with your values and shows its progress. The Migrate command it runs looks like this:
"C:\Program Files\Shinydocs Professional\ControlCenter\CognitiveToolkit.exe" Migrate --index-name "00000000-0000-0000-0000-000000000000" --index-server-url http://localhost:9200 --query "C:\Shinydocs\queries\match_all.json" --threads 16 --destination-source-settings "C:\Shinydocs\sources\contentserver.json" --start-location 123456 --path-prefix-to-remove "\\FS01\Finance"
Checking the Results:
Migrate shows its progress as it goes, and ends with an exit code:
| Exit code | Meaning |
|---|---|
| 0 | Every item the query found was migrated. |
| 1 | Some items failed, or a required parameter was missing. |
| 5 | A license problem, for example a license without migration. |
| -1 | Migrate stopped, for example because a settings file isn’t valid JSON or sign-in to the destination failed. |
Details of each failure are in the Cognitive Toolkit’s log file, CognitiveToolkit<date>.log, in its logs folder.
Migrate also records the result on each item in the index, so you can find failures with the Catalog’s advanced search, for example last-migration-status:error:
| Field | Value |
|---|---|
last-migration-status |
success or error |
last-migration-date |
When the item was last migrated. |
error-string |
Why the item failed. Empty when it succeeded. |
prop-content-id |
Where the item went: the node ID of the new document in Content Server. Set only when it succeeded. |
Running Migrate again processes every item the query finds, so each file already migrated becomes a new version of its document in Content Server. To migrate only the items that failed or haven’t been migrated yet, save this in the queries folder and set it on line 20:
JSON
{
"bool": {
"must_not": [
{ "match": { "last-migration-status": "success" } }
]
}
}
For the Migrate parameters the script uses, see CLI: Migration: File Share to File Share.
Subsequent Source Migrations:
Once this script is proven and working, any File System source crawled in Shinydocs Pro can be migrated by duplicating the script file, perhaps adding a name to each filename, for example ShinySync.cmd to ShinySync-LegalShare.cmd.
Change the values for lines 11, 13 and 16, and perhaps 19 (only if this requires an alternate Content Server login), to correspond to the new location.