Hello,
I'd like to create a batch file to traverse a directory and add all the .cpp and .h files to Vault.
Could someone give me an example of the vault command line, specifically what the repositoryfolder and localpath params would look like?
TIA.
Command line example?
Moderator: SourceGear
Re: Command line example?
I'm not sure the cmdline client is the way to do this. However:Traveler wrote:Hello,
I'd like to create a batch file to traverse a directory and add all the .cpp and .h files to Vault.
Could someone give me an example of the vault command line, specifically what the repositoryfolder and localpath params would look like?
TIA.
Suppose you have a file at c:\foo.cpp and you want to add this file into the repository folder at $/src/stuff, the command is:
Code: Select all
vault.exe ADD $/src/stuff c:\foo.cpp
Eric Sink
Software Craftsman
SourceGear
Software Craftsman
SourceGear
Thanks for the reply.
What I was looking for was what I finally figured out through trial and error:
Where NewFolder is an environment var set by this batch file -- it decides if the current dir gets a folder in Vault; if so, it sets the NewFolder env var.
Unfortunately, the "for %a in ()" is brutally slow. Any suggestions on how to make that part of the operation more efficient?
TIA.
What I was looking for was what I finally figured out through trial and error:
Code: Select all
for %a in (*.cpp *.h *.rc *.mak) do vault.exe add -user Admin -password pwd -host xx.xxx.xxx.xxx -repository King %NewFolder %_CWD\%a
Code: Select all
vault.exe CreateFolder -user Admin -password pwd -host xx.xxx.xxx.xxx -repository King %NewFolder
vault.exe Commit -user Admin -password pwd -host xx.xxx.xxx.xxx -repository King %NewFolder
TIA.
The "add" command can take more than one local item to add to a given repository folder. If it's possible to rewrite your script to do all files in a single folder at once, you can benefit from this syntax.
Vault 2.0's command-line client has a batch mode, which can read multiple commands from a file or stdin. Most of the startup time for the Vault client is constructing the web service classes (which is slow for reasons unknown to me) and logging into the service. Batch mode only has to startup and login once, and then can commit many transactions.
You may want to rewrite your program to construct a file which can then later be fed to Vault. The format of the file (call it "cmds.txt") would be something like this:
Invoke Vault like: vault.exe <...> batch cmds.txt
Vault 2.0's command-line client has a batch mode, which can read multiple commands from a file or stdin. Most of the startup time for the Vault client is constructing the web service classes (which is slow for reasons unknown to me) and logging into the service. Batch mode only has to startup and login once, and then can commit many transactions.
You may want to rewrite your program to construct a file which can then later be fed to Vault. The format of the file (call it "cmds.txt") would be something like this:
Code: Select all
add $/destination file1.txt
add $/destination file2.txt
add $/destination/sub file3.txt
commit
Shaw Terwilliger
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`