Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

command get directory -> moving items

Status
Not open for further replies.

AkiraKenshin

Programmer
May 18, 2005
17
0
0
CA
I wrote a simple batch file to read off file path and names from a textfile so that it can be retrieved from the VSS online database we set up. However, as we all know, SS.exe does not place files you "get" to the working folder, but rather the folder that you invoke ss.exe get (file) from, and it doesn't even create folders/subfolders so running it from the working folder won't work too well either.
Since the filenames in the textfile are from different projects, I can't simply use a loop to move them to the correct folder unless I used windows script to truncate strings and compare etc. etc. I want to keep this simple in the batch file so is there a way to do this? At least moving them to a separate folder is a start.

eg:
files.txt contains

$/app/can.cls
$/computer/system.inf

therefore looping
for every item in list, move item to folder
does not work, since 'item' is not just the filename, but the pathway as well on the DATABASE (can't move from online database to local folder)

I was deliberating hard coding folder names and then creating a textfile for each individual, and a textfilewith each folder name so i could make use of a nested loop. This requires much more work on behalf of the person updating the list of files to be retrieved automatically. However it IS a solution. I wonder if any of you can share a better one.
 
I had the same problem. The work around I came up with was as follows:

Batch file 1 - Essentially has a line for every folder in sourcesafe. I know this is tedious but you only have to do it once and add a line for every new folder you create. Every line has a call to Batch file 2 passing in the parameters of search label, directory of where you want the files to go, and temporary storage folder, and the source safe path.

Batch file 2 - it pretty much looks like this:
SET LABEL=%1
SET SOURCEDIR=%2
SET FOLDER=%4
SET SSPATH=%5
SET SOURCETEMP=%3

ss get %SSPATH%/*.* -vl%LABEL% -GL%SOURCETEMP% -R- -I-Y
if exist %SOURCETEMP%\*.sql GoTo Success
if exist %SOURCETEMP%\*.rpt GoTo Success
if exist %SOURCETEMP%\*.cfm GoTo Success
if exist %SOURCETEMP%\*.js GoTo Success
if exist %SOURCETEMP%\*.gif GoTo Success
if exist %SOURCETEMP%\*.php GoTo Success
if exist %SOURCETEMP%\*.cfc GoTo Success
if exist %SOURCETEMP%\*.cs GoTo Success
if exist %SOURCETEMP%\*.cpp GoTo Success
if exist %SOURCETEMP%\*.h GoTo Success
if exist %SOURCETEMP%\*.ico GoTo Success
if exist %SOURCETEMP%\*.csproj GoTo Success
if exist %SOURCETEMP%\*.sln GoTo Success
if exist %SOURCETEMP%\*.vb GoTo Success
if exist %SOURCETEMP%\*.vbproj GoTo Success
if exist %SOURCETEMP%\*.resx GoTo Success
if exist %SOURCETEMP%\*.doc GoTo Success
if exist %SOURCETEMP%\*.log GoTo Success
if exist %SOURCETEMP%\*.pdf GoTo Success
if exist %SOURCETEMP%\*.xls GoTo Success
if exist %SOURCETEMP%\*.txt GoTo Success
if exist %SOURCETEMP%\*.html GoTo Success
if exist %SOURCETEMP%\*.htm GoTo Success
if exist %SOURCETEMP%\*.css GoTo Success
if exist %SOURCETEMP%\*.jpg GoTo Success
Goto Exit0
ECHO The Sourcesafe Get for Development is complete

:Success
mkdir %SOURCEDIR%\%FOLDER%
move %SOURCETEMP%\*.* %SOURCEDIR%\%FOLDER%


:Exit0
 
Ahhh
What I ended up doing was to inform people that they would only be able to set up the automation with recursive "getting"
so i used the -r function and had them type in the folder paths

so text file:
development/me,
production/live feeds,

using a comma delimiter, you can get those folders out and have VSS recursively get them, and since you have the folder names, you can create them (for some reason the direction of the slash didn't matter) and I just had the batch file change directory before calling the get function so it woudl place the recursive files there.

It works fine but ss.exe has to be in PATH and you can't get it to work if you just want one file thats not at the top of the folder tree
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top