New
#1
ROBOCOPY Log File Question
Hi Folks,
I have been tinkering on and off with the Robocopy command to copy essential documents and files to an SD Card automatically, several times a day (this after my wife's laptop with SSD went belly-up and she lost her most recent work).
At the moment, there is a 'Pause' command to allow me to look at how Robocopy is behaving. All *seemed* to be well until I happened to glance at the screen one day and I saw an error flash by (which I subsequently tacked down) - this, however, isn't my issue.
What I noticed was that when scolling back up the screen log not everything was included - only the last parts of the whole operation - and I couldn't find the infomation about the error I had spotted - so I ran the batch file again and used Fn + Pause at the appropriate time to see the error.
The above is background to my question ...
Reading up about Robocopy, I found the command /log: <logfile> where the status output can be directed into a text file.
The question I have is this.
My batch file has 25 lines in it - such as
Set BackupDrive=M:
Robocopy "C:\Users\Phil\Downloads" "%BackupDrive%\Downloads" /S /R:3 /MT:1 /DCOPY:DAT /XA:SH /MIR /W:3
Robocopy "C:\Users\Phil\Music" "%BackupDrive%\My Music" /S /R:3 /MT:1 /DCOPY:DAT /XA:SH /MIR /W:3
Robocopy "C:\Users\Phil\Pictures" "%BackupDrive%\My Pictures" /S /R:3 /MT:1 /DCOPY:DAT /XA:SH /MIR /W:3
Robocopy "C:\Users\Phil\Videos" "%BackupDrive%\My Videos" /S /R:3 /MT:1 /DCOPY:DAT /XA:SH /MIR /W:3
I have saved a text document (called "SD-logfile") in the location on C: drive that I have used for the backup batch file - namely: /log: C:\Users\Phil\Documents\COMPUTER STUFF\AUTO BACKUP to SD CARD
Do I have to append "/log: C:\Users\Phil\Documents\COMPUTER STUFF\AUTO BACKUP to SD CARD\SD-Logfile"
to each and every one of the 24 command lines (four samples of which are shown above).
or
Can I just issue this command once (like the Set backupDrive command) using something like Log=C:\Users\Phil\Documents\COMPUTER STUFF\AUTO BACKUP to SD CARD\SD-Logfile?
If I can do it just the once, could someone show me what form that command should take (I'm a complete noob at witing scripts and batch files).
Thanks in advance,
Art
Using this batch file on 3 different PCs - one using Win 10 and two using Win 7. Currently writing this on a Win 7 laptop.