xcopy log file (1 Viewer)

irish634

Registered User.
Local time
Today, 00:21
Joined
Sep 22, 2008
Messages
230
Hi Everyone,

I've been poking around ad this for a few days and can't seem to come up with an answer.

I am using an old school batch file calling the xcopy function to back up some OEM equipment files.

Code:
IF EXIST C:\BackupLog.TXT GOTO LOG

:CREATE
ECHO Backup Log > C:\BackupLog.TXT
ECHO. >> C:\BackupLog.TXT

:LOG
Echo ------------------------- >> C:\BackupLog.TXT
Echo NetworkCopy Started: %date% %time%  >> C:\BackupLog.TXT
xcopy /e/h/r/y "c:\test" "Y:\test"[COLOR=Red][B] >> C:\BackupLog.TXT[/B][/COLOR]
If ErrorLevel 0 Echo Files Copied Without Error >> C:\BackupLog.TXT
If ErrorLevel 1 Echo No Files Found to Copy >> C:\BackupLog.TXT
If ErrorLevel 2 Echo User Pressed CTRL+C To Stop Backup >> C:\BackupLog.TXT
If ErrorLevel 4 Echo Invalid Drive or Low Memory >> C:\BackupLog.TXT
If ErrorLevel 5 Echo Disk Write Error Occured >> C:\BackupLog.TXT
Echo NetworkCopy Ended: %date% %time%  >> C:\BackupLog.TXT
Echo ------------------------- >> C:\BackupLog.TXT

cls
@Exit

This works fine except I don't really need to log ALL the files that are backed up which comes from my highlighted text.

The resulting log file produces this:
-------------------------
NetworkCopy Started: Fri 10/16/2009 14:32:36.12
C:\test\Lead_Forming.mdb
C:\test\New Text Document.txt
C:\test\winzip.log
3 File(s) copied
Files Copied Without Error
NetworkCopy Ended: Fri 10/16/2009 14:32:36.50
-------------------------

This is only a test folder. The folders I am copying have 1000's of files. I of course don't need a log of all the file names that were copied. However I would still like to list the number of files that were copied as well as only a list of those files that WERE NOT copied or had a problem.

Is there an easy way to do this?

Thanks,
Craig
 

mcclunyboy

Registered User.
Local time
Yesterday, 21:21
Joined
Sep 8, 2009
Messages
292
Hi,

im not sure...I am pretty sure the /D switch which 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.

If your PC is newer you could use Robocopy which is slightly better - think that is vista only..

Sorry I can't be more help.
 

Users who are viewing this thread

Top Bottom