blank.gif (43 bytes)

Church Of The
Swimming Elephant




To copy all the files and subdirectories (including any empty subdirectories) from the disk in drive A to the disk in drive B:

xcopy a: b: /s /e

To include any system or hidden files in the previous example, add the /h switch:

xcopy a: b: /s /e /h

To update files in the REPORTS directory with the files in the directory RAWDATA that have changed since December 29, 1993

xcopy \rawdata \reports /d:12-29-93

To update all the files that exist on \REPORTS in the previous example, regardless of date, type

xcopy \rawdata \reports /u

To obtain only a list of the files that would be copied for the previous command, without copying the files, type

xcopy \rawdata \reports /d:12-29-93 /l > xcopy.out

The file XCOPY.OUT lists every file that would be copied.

To copy the \CUSTOMER directory and all subdirectories, including empty directories, to the directory \PUBLIC\ADDRESS on network drive H: and retain the read-only attribute, while being prompted when a new file will be created on H:, type

xcopy \customer h:\public\address /s /e /k /p

To issue the previous command and ensure xcopy creates the directory \ADDRESS if it does not exist, without prompting, add the /i switch:

xcopy \customer h:\public\address /s /e /k /p /i

You can create a batch program to perform xcopy operations and use the batch if command to process the exit code in case an error occurs. For example, the following batch program uses replaceable parameters for the xcopy source and destination parameters:

@echo off
rem COPYIT.BAT transfers all files in all subdirectories of
rem the source drive or directory (%1) to the destination

rem drive or directory (%2)

xcopy %1 %2 /s /e

if errorlevel 4 goto lowmemory
if errorlevel 2 goto abort
if errorlevel 0 goto exit

echo Insufficient memory to copy files or
echo invalid drive or command-line syntax.
goto exit

echo You pressed CTRL+C to end the copy operation.
goto exit


To use this batch program to copy all files in the C:\PRGMCODE directory and its subdirectories to drive B, type the following command:

copyit c:\prgmcode b:

The command interpreter substitutes C:\PRGMCODE for %1 and B: for %2, then uses xcopy with the /e and /s switches. If xcopy encounters an error, the batch program reads the exit code and goes to the label indicated in the appropriate if errorlevel statement. Windows NT displays the appropriate message and exits from the batch program.

More Information About Xcopy

ntcmds00000001.gif Xcopy--Notes

ntcmds00000001.gif Xcopy


Protect yourself from cyberstalkers, identity thieves, and those who would snoop on you.
Stop spam from invading your inbox without losing the mail you want. We give you more control over your e-mail than any other service.
Block popups, ads, and malicious scripts while you surf the net through our anonymous proxies.
Participate in Usenet, host your web files, easily send anonymous messages, and more, much more.
All private, all encrypted, all secure, all in an easy to use service, and all for only $5.95 a month!

Service Details

Have you gone to church today?
All pages ©1999, 2000, 2001, 2002, 2003 Church of the Swimming Elephant unless otherwise stated
Church of the Swimming Elephant©1999, 2000, 2001, 2002, 2003 is a wholly owned subsidiary of Packetderm, LLC.

Packetderm, LLC
210 Park Ave #308
Worcester, MA 01609