[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Script for recursive add under Windows?
From: |
John Minnihan |
Subject: |
Re: Script for recursive add under Windows? |
Date: |
Tue, 23 Oct 2001 08:53:06 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010628 |
address@hidden wrote:
Hi!
I've been using CVS for a while and there's one thing which I'm rather
baffled by: the lack of a recursive add function, which would
essentially do what you'd expect an "intuitive" combination of import
and add to do.
In lack of this functionality, I'm wondering if anyone has a shell
script for DOS under Windows 2000 (yes, yes, I know, but life isn't
perfect) which would do it? Or, in fact, any script or program which
would run under a standard Win2000 install.
Grateful for any help or information on the subject.
Cut here:
---->8------->8---------->8---
@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,*.class,*.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 Contributor: John Minnihan
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