info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to add multible directories and files in one command line ..


From: John Minnihan
Subject: Re: how to add multible directories and files in one command line ..
Date: Wed, 26 Sep 2001 21:23:02 -0700
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010628

address@hidden wrote:

How do I add a number of subdirectories and files into an existing
CVS-repository in one command line ?

Here's a DOS batch file that does that operation quite well. Modify the cvs_add_list to satisfy your needs:
===============
@ECHO OFF

SETLOCAL
REM Set up a string that specifies all files we want to check in
SET cvs_add_list=*.cpp,*.c,*.pl,*.html,*.xml,*.txt,*.java,*.pm


:parse_options
if NOT "%1"=="/?" goto add_tree_head
ECHO Adds a directory tree of files to CVS
ECHO.
ECHO ADD_TREE [directory]
ECHO.
ECHO If directory is passed, then that directory will be used as
ECHO the root directory for the add operation - that directory
ECHO and all sub-directories will be added.
ECHO.
ECHO Files are added according to the filter stored in the environment
ECHO variable ADD_TREE_FILTER.  If this is unset, the default value of
ECHO %cvs_add_list%
ECHO is used...
ECHO.
ECHO Files are added in each sub-directory.
ECHO There is no way (today!) to specify exception files or exception directories.
ECHO.
ECHO Author: John Minnihan
ECHO Author: Nick Furness

GOTO :EOF

:add_tree_head
set head_dir= "%1"
IF NOT DEFINED head_dir echo Adding subtree only...
IF NOT DEFINED head_dir goto add_subtree
IF NOT EXIST %1 @ECHO Bad File: %1
IF NOT EXIST %1 GOTO :EOF

cvs add %1
CD %1

goto add_remainder_of_subtree

:add_subtree
@CD %1

:add_remainder_of_subtree
ECHO.
ECHO.
ECHO.
CD
ECHO *********************************************************
ECHO Adding directories...
ECHO *********************************************************
FOR /D %%i in (*) DO IF /I NOT "%%i"=="CVS" cvs add "%%i"
ECHO *********************************************************

IF DEFINED add_tree_filter set cvs_add_list=%add_tree_filter%

REM Note that because the cvs_add_list might not only contain
REM wildcard search expressions, we could attempt to add a file
REM that isn't there.  Silly, but true.  So we'll check.

ECHO Adding files...
ECHO *********************************************************
FOR %%i IN (%cvs_add_list%) DO IF EXIST "%%i" cvs add "%%i"
ECHO *********************************************************

REM And recurse for all the directories below...
FOR /D %%i IN (*) DO IF /I NOT "%%i"=="CVS" call :add_subtree "%%i"
CD ..

GOTO :EOF

ENDLOCAL


--
John Minnihan
mailto:address@hidden
http://www.freepository.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]