Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a robocopy script to back up our Kiln repositories that runs nightly, which looks something like this:

robocopy "$liveRepoLocation" "$cloneRepoLocation" /MIR /MT /W:3 /R:100 /LOG:"$backupLogLocation\BackupKiln.txt" /NFL /NDL /NP

In the output, there are a ton of lines that contain "Extra file"s, like this:

*EXTRA File              153    E:\Kiln Backup\elasticsearch\data\elasticsearch-kiln\nodes\0\indices\kiln-2\0\index\_yxe.fdt
*EXTRA File               12    E:\Kiln Backup\elasticsearch\data\elasticsearch-kiln\nodes\0\indices\kiln-2\0\index\_yxe.fdx
*EXTRA File              128    E:\Kiln Backup\elasticsearch\data\elasticsearch-kiln\nodes\0\indices\kiln-2\0\index\_yxe.fnm
*EXTRA File              363    E:\Kiln Backup\elasticsearch\data\elasticsearch-kiln\nodes\0\indices\kiln-2\0\index\_yxe.frq
*EXTRA File               13    E:\Kiln Backup\elasticsearch\data\elasticsearch-kiln\nodes\0\indices\kiln-2\0\index\_yxe.nrm

Additionally, there are then hundreds of lines at the bottom that contain nothing but "100%"s, like this:

100%  
100%  
100%  
100%  
100%  
100%  
100%  

In addition to making the log files enormous (there are a lot of folders/files in Kiln repos), it makes it annoying to scan through the logs now and then to see if everything was working ok.

  1. How do I stop "Extra Files" appearing in the log? (edit: the whole rows, not just the text as /NC will stop)
  2. How do I stop these silly "100%" lines appearing in the log?

I've tried every combination of switch I can think of (the current switches are listed above in the command), but neither seem to hide these!

share|improve this question
    
You have 20 seconds to comply! –  CraigTP Nov 28 '12 at 8:22
    
@CraigTP Typo fixed :-P –  Danny Tuppeny Nov 28 '12 at 8:22
    
According to ss64.com/nt/robocopy.html it should be working. Have you tried changing the params order to mirror the documentation? That would be: /L /NP /LOG:file /UNILOG:file /LOG+:file /UNILOG+:file /TS /FP /NS /NC /NFL /NDL /TEE /NJH /NJS –  Luiz Angelo Nov 28 '12 at 10:20
add comment

2 Answers

up vote 5 down vote accepted

Just noticed you are missing a /NC there.

/NC: No Class - don’t log file classes.

Class files are... What does robocopy mean by tweaked, lonely and extra?

So I'd try: robocopy "$liveRepoLocation" "$cloneRepoLocation" /MIR /MT /W:3 /R:100 /NP /LOG:"$backupLogLocation\BackupKiln.txt" /NC

Edit 1

My bad. Didn't see you had already mentioned trying /NC

I've tested here. It seems that the /MIR option ignores the logging options. Also /MT messes it up, adding the 100%.

The only way I got working was

D:\robocopy>robocopy source destination /MIR /W:3 /R:100 /NS /NC /NFL /NDL /NP /LOG:log.txt".

*It actually works with /MIR. But you have to specify /NFL and /NDL.* Don't know if that's acceptable for you.

If you try /MT, it will still show the silly 100%

Edit 2

I know the question was about Robocopy but I think you should give RichCopy a try http://technet.microsoft.com/en-us/magazine/2009.04.utilityspotlight.aspx

Here's the command line:

richcopy "D:\robocopy\source" "D:\robocopy\destination" /P /QO /QP "D:\robocopy\report.log" /UE /US /UD /UPC /UFC /USC /UPR /UET

It starts RichCopy's GUI and closes when done.

And here's the log

28/11/2012 11:35:19,0,Copy start,

28/11/2012 11:35:20,0,Source path : D:\robocopy\source,

28/11/2012 11:35:20,0,Destination path : d:\robocopy\destination,

28/11/2012 11:35:20,0,Source file count : 12 files,

28/11/2012 11:35:20,0,Copied file count : 13 files,

28/11/2012 11:35:20,0,Purged file count : 1,224 files,

28/11/2012 11:35:20,0,Elapsed time : 00:00:01,

28/11/2012 11:35:20,0,Average performance : 1,641,528 bytes / sec,

28/11/2012 11:35:20,0,Average performance : 13 files / sec,

28/11/2012 11:35:20,0,Copy complete,D:\robocopy\source

share|improve this answer
    
/NC just removes the "Extra File" column, so the text isn't shown. The rest of the line is still included. I don't want the line at all; I just want the summary :( –  Danny Tuppeny Nov 28 '12 at 12:31
    
My bad. Didn't see you had already mentioned that. I've tested here. It seems that the /MIR option ignores the logging options. Also /MT messes it up. The only way I got working was " D:\robocopy>robocopy source destination /MIR /W:3 /R:100 /NS /NC /NFL /NDL /NP /LOG:log.txt". If you try /MT, it will still show the silly 100%. –  Luiz Angelo Nov 28 '12 at 13:18
    
The 100%'s are the worst part (far more of them than extra files); didn't realised it was MT doing this, so might remove that if it's not giving a huge benefit! –  Danny Tuppeny Nov 28 '12 at 13:36
    
Marking this as correct as it's a solution to the 100%'s, and I don't think there's a solution to the "Extra file" logging with /MIR :( –  Danny Tuppeny Nov 28 '12 at 13:39
    
I just edited my original answer. Just posting a new comment so you won't miss it. –  Luiz Angelo Nov 28 '12 at 13:41
show 2 more comments

how about using the switches

 /MIR /MT /W:3 /R:100 /NFL /NDL /NP 2>&1 | findstr /v /L /C:" * EXTRA " | findstr /v /L /C:"100%%" > "log file name with or without path"

so you have

robocopy "$liveRepoLocation" "$cloneRepoLocation" /MIR /MT /W:3 /R:100 /NFL /NDL /NP 2>&1 | findstr /v /L /C:" * EXTRA " | findstr /v /L /C:"100%%" > "$backupLogLocation\BackupKiln.txt"
  • the double %% is required to have a % in the search string
  • the 2>&1 redirects the stderr stream to stdout because some messages are written to stderr and we want to capture those lines like the /LOG switch does.
  • the 2 findstr commands with the /v switch finds all lines that do not contain the search string
  • the > "log filename" redirects the final output to your log file. If you would normally use /LOG:+ then use >> "log filename" instead

Notes: if you are using this in a powershell script, like you seem to be, you need to use findstr instead of find like you can in a .bat or .cmd file. Note the /L and /C: are not supported by find but for the find command they are not required.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.