Xcopy cyclic copy error in 2003, works fine in 2000

G

Guest

I have a batch file (pasted below). It worls fine in W2K server, but I get a
"cannot perform a cyclic copy" error in Win 2003 server. I'm very stumped.
I've seen the question posed around the net, but no answers. Thanks for
looking.

Scott

rem *** Check usage.


if "%~1" EQU "/?" goto Usage
if "%~1" EQU "-?" goto Usage
if "%~1" EQU "?" goto Usage
if "%~1" EQU "" goto Usage


rem set environment

set PROGNAME=%~1
set OUTDIR=%~2
set OLDNAME=%~3
set NEWNAME=%~4

rem Check old files don't already exist

dir %OUTDIR%\%OLDNAME% /s


if %errorlevel% LSS 1 goto OVERWRITE


:START

cls
echo Run and Rename Batch File
echo .
echo PROGNAME= %PROGNAME%
echo OUTDIR = %OUTDIR%
echo OLDNAME = %OLDNAME%
echo NEWNAME = %NEWNAME%
echo.
echo.

%PROGNAME%

rem 09apr2004 JL on error exit with errorcode ------
if %errorlevel% GTR 0 exit %errorlevel%
rem 09apr2004 JL on error exit with errorcode ------

xcopy %OUTDIR%\%OLDNAME% %OUTDIR%\%NEWNAME% /Y /E /S
if %errorlevel% GTR 0 goto END

del %OUTDIR%\%OLDNAME% /Q/S

goto END


:USAGE

echo USAGE: run_ren "programname" "outputdir" "oldname" "newname" [/Q]
echo.
echo ex. runandren "reg_age.exe "" rif 06nov2003 68 """ "%iWBREPDIR"
"reg_age.re?" "reg_age_rif.re?" /Q
echo.
echo *** Must use quotes around parameters
echo *** Use a wildcard ? on file names to allow for proper replacement.
echo *** WARNING: With wildcards, reg_age.rep and reg_age.ret are the
same!
echo.
echo /Q for disable overwrite protection
echo.
echo *** Use /Q with caution when using ECS. Avoid having two jobs
conflicting.

if /I "%RUNFROM%" EQU "ECS" goto OWERROR
pause
goto END


:OVERWRITE
if /I "%5" EQU "/Q" goto DELFILES

if /I "%RUNFROM%" EQU "ECS" goto OWERROR

cls
if not defined iwbecsdir goto NOTDEFINED

echo Files %OLDNAME% were found in %OUTDIR%
echo.
%iWBECSDIR%\query.exe "Do you want to continue (N/Y)? " NY 60
if not errorlevel 1 goto END

:DELFILES
del %OUTDIR%\%OLDNAME% /Q /S
goto START


:NOTDEFINED
echo iWBECSDIR is not defined!
if /I "%RUNFROM%" EQU "ECS" goto OWERROR
pause
goto end

:OWERROR
exit 1

:END
 
B

billious

Scott Closter said:
I have a batch file (pasted below). It worls fine in W2K server, but I get
a
"cannot perform a cyclic copy" error in Win 2003 server. I'm very stumped.
I've seen the question posed around the net, but no answers. Thanks for
looking.

Scott

rem *** Check usage.


if "%~1" EQU "/?" goto Usage
if "%~1" EQU "-?" goto Usage
if "%~1" EQU "?" goto Usage
if "%~1" EQU "" goto Usage


rem set environment

set PROGNAME=%~1
set OUTDIR=%~2
set OLDNAME=%~3
set NEWNAME=%~4

rem Check old files don't already exist

dir %OUTDIR%\%OLDNAME% /s


if %errorlevel% LSS 1 goto OVERWRITE


:START

cls
echo Run and Rename Batch File
echo .
echo PROGNAME= %PROGNAME%
echo OUTDIR = %OUTDIR%
echo OLDNAME = %OLDNAME%
echo NEWNAME = %NEWNAME%
echo.
echo.

%PROGNAME%

rem 09apr2004 JL on error exit with errorcode ------
if %errorlevel% GTR 0 exit %errorlevel%
rem 09apr2004 JL on error exit with errorcode ------

xcopy %OUTDIR%\%OLDNAME% %OUTDIR%\%NEWNAME% /Y /E /S
if %errorlevel% GTR 0 goto END

del %OUTDIR%\%OLDNAME% /Q/S

goto END


:USAGE

echo USAGE: run_ren "programname" "outputdir" "oldname" "newname" [/Q]
echo.
echo ex. runandren "reg_age.exe "" rif 06nov2003 68 """ "%iWBREPDIR"
"reg_age.re?" "reg_age_rif.re?" /Q
echo.
echo *** Must use quotes around parameters
echo *** Use a wildcard ? on file names to allow for proper replacement.
echo *** WARNING: With wildcards, reg_age.rep and reg_age.ret are the
same!
echo.
echo /Q for disable overwrite protection
echo.
echo *** Use /Q with caution when using ECS. Avoid having two jobs
conflicting.

if /I "%RUNFROM%" EQU "ECS" goto OWERROR
pause
goto END


:OVERWRITE
if /I "%5" EQU "/Q" goto DELFILES

if /I "%RUNFROM%" EQU "ECS" goto OWERROR

cls
if not defined iwbecsdir goto NOTDEFINED

echo Files %OLDNAME% were found in %OUTDIR%
echo.
%iWBECSDIR%\query.exe "Do you want to continue (N/Y)? " NY 60
if not errorlevel 1 goto END

:DELFILES
del %OUTDIR%\%OLDNAME% /Q /S
goto START


:NOTDEFINED
echo iWBECSDIR is not defined!
if /I "%RUNFROM%" EQU "ECS" goto OWERROR
pause
goto end

:OWERROR
exit 1

:END

Might help if you told us what parameters you're feeding into this routine.
Can't see why there would be a difference though!
 
D

dbareis [Windows Installer MVP]

Hi,

I assume the source and destination names don't overlap, have you
echoed the complete command line?

Its possible that someone has mounted other directories and I assume
its
possible to build a loop if you weren't careful.
I think sysinternals have a program which will display the links
(http://www.sysinternals.com/Utilities/Junction.html) but I
assume if instead of a copy you used a "dir" command,
you'd also see if there was a problem...

Bye,
Dennis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top