adding directories and files using the command line

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
vuser01
Posts: 18
Joined: Mon Feb 27, 2006 7:07 pm

adding directories and files using the command line

Post by vuser01 » Mon Apr 03, 2006 3:01 pm

I would like to add both directories and files into vault through a batch file. Is there a way to do this?

Example:

$/dir1/file1
$/dir1/file2
$/dir2/file1
etc ...

dir1 & dir2 don't exist in vault as well as file1 and file2

I have tried to use the add command per dir and per file, but only the first line went into the changeset.

dan
Posts: 2448
Joined: Wed Dec 17, 2003 5:03 pm
Location: SourceGear
Contact:

Post by dan » Mon Apr 03, 2006 3:46 pm

This should work. Can you provide the exact command you are using to accomplish it? Note that the files and folders should all be in the same CLC command, separated by spaces, and quotes around each if there are spaces.

vuser01
Posts: 18
Joined: Mon Feb 27, 2006 7:07 pm

Post by vuser01 » Mon Apr 03, 2006 5:26 pm

The batch file contains the following:

@echo off
vault add -host -user ...
vault add -host -user ...
vault add -host -user ...
vault add -host -user ...
etc ...

If it is possible, can you please specify what is the correct format as an example?

dan
Posts: 2448
Joined: Wed Dec 17, 2003 5:03 pm
Location: SourceGear
Contact:

Post by dan » Mon Apr 03, 2006 9:56 pm

something like:

vault add -user user -password pw -host host -repository repository -commit $/vault/folder "c:\temp\file1.cpp" "c:\project\folder1" "c:\hello.txt"

vuser01
Posts: 18
Joined: Mon Feb 27, 2006 7:07 pm

Post by vuser01 » Tue Apr 04, 2006 1:35 pm

How would I implement the same thing if the files are going to different locations in vault. The example you have given places all the files residing in different locations on the local box in the same location in vault, however, if the files need to go to different locations in vault, would I need to create a seperate lines and how would it all work if I wanted to have the checkin use the same submission number with the scenerio I have given above? Can you please show an example?

dan
Posts: 2448
Joined: Wed Dec 17, 2003 5:03 pm
Location: SourceGear
Contact:

Post by dan » Tue Apr 04, 2006 3:34 pm

Don't include "vault" or the connection info in the batch file itself.

So, your CLC call should be:

vault -host host -name name -password pw -repository rep batch batch.txt

And the commands in the batch file (one per line, no extra lines) should be:

add -commit $/repfolder c:/temp/file
add -commit $/test1 c:/Temp/folder

Post Reply