back to content

Examples (For Windows Command Line)

All examples in this section are based on the following assumptions:

Example 1: Add a folder to the repository
Example 2: Add a file to project
Example 3: Get a file
Example 4: Get file list
Example 5: Check in a file
Example 6: Check out a file
Example 7: Label a file
Example 8: Retrieve all files in a project by a label
Example 9: Share a project with another project
Example 10: Branch a shared file
Example 11: Delete a project permanently
Example 12: Put the Command Line Client in an interactive shell
Example 13: Add a file to project in an interactive shell

Example 1: Add a folder to the repository
----------------------------------------
This adds an entire folder located at "c:\projects\new" on the local machine to the project "$/123" in Dynamsoft SourceAnywhere repository.

SAWSCmd AddFolder -server demo.Dynamsoft.com -port 7777 -username test -pwd test -repository "Dynamsoft SourceAnywhere"  -workdir c:\projects\new  -prj $/123/new -tempdir D:\temp

Example 2: Add a file to project
----------------------------------------
This adds a file "test.txt" to "$/123" project.

SAWSCmd AddFile -server demo.Dynamsoft.com -port 7777 -username test -pwd test -repository "Dynamsoft SourceAnywhere" -workdir "c:\projects\test" -file "test.txt" -prj $/123  -tempdir "D:\temp"

Example 3: Get a file
---------------------
This places the latest version of the file "test.txt" into the working folder.

SAWSCmd GetLatestFiles -server demo.Dynamsoft.com -port 7777 -username test -pwd test -repository "Dynamsoft SourceAnywhere" -workdir c:\projects\test -prj $/123 -file text.txt  -tempdir D:\temp

Example 4: Get file list
------------------------------
This gets the list of files in the "$/123" project.

SAWSCmd GetFileList -server demo.Dynamsoft.com -port 7777 -username test -pwd test -repository "Dynamsoft SourceAnywhere" -prj $/123 -tempdir D:\temp

Example 5: Check in a file
---------------------------
This checks in the previously checked out file "test.txt", located on the working folder at "c:\projects\test".

SAWSCmd CheckInFile -server demo.Dynamsoft.com -port 7777 -username test -pwd test -repository "Dynamsoft SourceAnywhere" -workdir c:\projects\test -prj $/123 -file test.txt -tempdir D:\temp  -comment "Added function HelloWorld"

Example 6: Check out a file
---------------------------
This checks out the latest version of the file "test.txt" and places it into the working folder.

SAWSCmd CheckOutFile -server demo.Dynamsoft.com -port 7777 -username test -pwd test -repository "Dynamsoft SourceAnywhere" -workdir c:\projects\test -prj $/123 -file test.txt -tempdir D:\temp

Example 7: Label a file
--------------------------
This applies the label "Version 3" to file "test.txt" in Dynamsoft SourceAnywhere database.

SAWSCmd AddLabel -server demo.Dynamsoft.com -port 7777 -username test -pwd test -repository "Dynamsoft SourceAnywhere"  -workdir c:\projects\test -prj $/123 -file text.txt -label "Version 3" 

Example 8: Retrieve all files in a project by a label
----------------------------------------------------------
This gets a previous version of files in a project from a label in Dynamsoft SourceAnywhere database.

SAWSCmd GetProject -server demo.Dynamsoft.com -port 7777 -username test -pwd test -repository "Dynamsoft SourceAnywhere" -workdir c:\projects\test -prj $/123 -file text.txt -label "version 1" -tempdir D:\temp

Example 9: Share a project with another project
-----------------------------------------------
This shares the current version of the project "$/123" with the project "$/projects/Dynamsoft SourceAnywhere" in Dynamsoft SourceAnywhere repository.

SAWSCmd ShareProject -server demo.Dynamsoft.com -port 7777 -username test -pwd test -repository "Dynamsoft SourceAnywhere" -prj $/123 -shareto $/projects/Dynamsoft SourceAnywhere -comment "Sharing project 123 into project Dynamsoft SourceAnywhere"

Example 10: Branch a shared file

----------------------------------
This branches files "test.txt" which was previously shared with another files in Dynamsoft SourceAnywhere repository.

SAWSCmd BranchFile -server demo.Dynamsoft.com -port 7777 -username test -pwd test -repository "Dynamsoft SourceAnywhere" -prj $/123 -file test.txt

Example 11: Delete a project permanently
----------------------------------------
This deletes project "$/123" permanently from Dynamsoft SourceAnywhere repository.

SAWSCmd Delete -server demo.Dynamsoft.com -port 7777 -username test -pwd test -repository "Dynamsoft SourceAnywhere" -prj $/123 -permanent

Example 12: Put the Command Line Client in an interactive shell

----------------------------------------

This puts the Command Line Client in an interactive shell.

SAWSCmd Interactive -server demo.Dynamsoft.com -port 7777 -username test -pwd test -repository "Dynamsoft SourceAnywhere" -tempdir D:\temp

Example 13: Add a file to project in an interactive shell
----------------------------------------

This adds a file to project in an interactive shell.

AddFile -file "test.txt" -prj $/123

Note:

These examples are for Windows Command Line. For Java Command Line, the commands should begin with "java -jar SourceAnywhereSCmd.jar" instead of "SAWSCmd" in these examples.