1.

Solve : XCOPY Error LOG??

Answer»

I use the following XCOPY syntax to backup to an external HDD:

xcopy /h /i /c /s /e /y C:\"Documents and Settings"\*.* G:\Backup\ /d


Q. How can I create an error log?

Q. How can I log files changed / new files copied?This code may work:

set log=c:\xcopy.log
set error=c:\xcopy.error.log
echo %DATE% %time% >> %log%
echo %date% %time% >> %error%
xcopy "c:\mirc\*.*" c:\test\ /c/y/i/e/v/f >> %log% 2>> %error%

[glb]Gizmo73[/glb]It works!

Q. What does the 2 >> mean?

Q. Can I put another 3 >> %user% behind it?DOS commands allocate devices for it's output. STDOUT which is USED generally for INFORMATIONAL messages that record the programs PROGRESS and STDERROR which is used for errors. By using >> %log%, you redirected the STDOUT data STREAM to whatever device %log% defined; by using 2>> %error% you redirected the STDERROR data stream to whatever device %error% defined.

I am not aware of a third device, but DOS can be quirky, so you never know.

Hope this helps.



Discussion

No Comment Found