MS-DOS 3.3x and above
Windows 95
Windows 98
Windows ME
Windows NT
Windows 2000
Windows XP
Windows Vista
Windows 7
Copy below command into a text file and rename txt to bat and change "test" to your folder name. You can also duplicate xcopy command if you have several folders.
------
@echo off
xcopy z:\test\*.* l:\test\ /e /h /v /d /y /c
------xcopy z:\test\*.* l:\test\ /e /h /v /d /y /c
EXAMPLE1:
--------------
@echo off
xcopy z:\test\*.* l:\test\ /e /h /v /d /y /c >z:\report test.txt <---Add ">z:\test.txt" at the end to make a log file.
xcopy z:\test\*.* l:\test\ /e /h /v /d /y /c >z:\report test.txt <---Add ">z:\test.txt" at the end to make a log file.
EXAMPLE2:
--------------
@echo off
Mkdir "%DATE%" <---Make a new directory by current date
move report.txt "%DATE%" <---Move txt files to new directory
xcopy "L:\Very long folder name\*.*" "D:\Very long folder name\" <--- add " " when you have long folder name otherwise you'll get error
[SYNTAX]
ECHO [ON | OFF] ON : Display each line of the batch on screen (default)
OFF : Only display the command output on screen message : a string of characters to display
/D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time.
/E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T.
/V Verifies each new file.
/C Continues copying even if errors occur.
/H Copies hidden and system files also.
/Y Suppresses prompting to confirm you want to overwrite an existing destination file.
/S Copies directories and subdirectories except empty ones.
http://www.computerhope.com/xcopyhlp.htm (XCOPY SYNTAX)
No comments:
Post a Comment