Wednesday, October 17

Copying a directory, including files in sub directories

XCOPY
The XCOPY command copies one or more complete directories, including the files in the sub directories, from a hard disk or a diskette to another drive or another directory.
Points to Remember :
- this can copy to a diskette of a different format (which is impossible using DISKCOPY command.
- it allows you to copy files that have been changed since a particular date.
Syntax
XCOPY [drive1:] [Path]source [drive2:] [Path]destination] [/A][/M][/D:date][/P][/S][/E][/V][/W]
[drive1:][Path]source : source drive, directory and location, name of the source file or files.
[drive2:][Path2:] destination : destination drive, directory and name of the destination file or files.
/A : copies files that have archive attributes set, without changing the attributes.
/M : copies files that have archive attribute set and turns the attribute off.
/D:date : copies source files modified on or  after the specified date.
/P : prompt for confirmation before creating each destination file.
/S : copies all source directories and sub directories that are not empty.
/E : copies all sources sub directories including empty ones. (use /S with /E option)
/V : verifies each file as it is written to the destination file.
/W : waits for you to press a key before copying.
To perform this, you have to us the commands as follow :
Example 1
C:\>XCOPY \CLASS9 A:\CLASS/S/E  ( press enter key )

Example 2  
C:\>XCOPY A: B: /S  ( press enter key )
It copies all, source directories and sub directories of the diskette in drive A: to the diskette in drive B

Example 3
C:\>XCOPY A:/S B:/V ( press enter key )
It copies all directory and sub directories and files of drive A: to the drive B: with verification.

Example 4
C:\>XCOPY C:\DBASE \ *.DBF A: \ S/D:12-1-95 ( press enter key)
It copies all files with the extension .DBF from DBASE directory and its sub directories on drive C: to drive A: only i those files were created or modified on or after December 1, 1995.


No comments:

Post a Comment