How do I hide "Extra File" and "100%" lines from robocopy output?

18

5

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!

Danny Tuppeny

Posted 2012-11-28T08:21:46.100

Reputation: 2 249

According to http://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 – 2012-11-28T10:20:38.640

Answers

9

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

Luiz Angelo

Posted 2012-11-28T08:21:46.100

Reputation: 1 297

1/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 – 2012-11-28T12:31:47.790

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 – 2012-11-28T13:18:38.473

1The 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 – 2012-11-28T13:36:41.157

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 – 2012-11-28T13:39:36.143

I just edited my original answer. Just posting a new comment so you won't miss it. – Luiz Angelo – 2012-11-28T13:41:54.747

Thanks for the info; it's not important enough for me to change (everything works, it's just a little convenience), but handy to know for future :-) – Danny Tuppeny – 2012-11-28T13:58:29.173

@LuizAngelo: I assume you didn't want to repeat /NFL twice, so I corrected the typo. If the edit was incorrect, you can revert it. – Karan – 2012-11-29T17:40:12.703

5

The /XX option excludes the extra files from being listed. Perversely, this option is listed in File Selection options, not Logging. It is the opposite of the /X logging option, I guess.

Keith

Posted 2012-11-28T08:21:46.100

Reputation: 59

1I believe /XX prevents you from selecting the extra files, and /X is just for logging, but allows you display EVEN MORE extra files ! The /XX did the trick for me. – sonjz – 2015-07-28T23:54:36.923

1-1, because /XX leaves the extra file on the destination, instead of deleting it, as expected of the mirroring process. – mark – 2018-09-30T02:44:00.530

3

I think this may work:

robocopy sourceDir targetDir *.* /njh /njs /ndl /np | find /v "*EXTRA File"

So just pipe the output to "find" with the /V for excluding lines which contain the specified text "*Extra File".

Svein Terje Gaup

Posted 2012-11-28T08:21:46.100

Reputation: 31

How to exclude the % progress (0 to 100% counter) from the log only (but still visible on the console)? – PeterCo – 2016-07-27T08:55:01.167

0

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.

BeowulfNode42

Posted 2012-11-28T08:21:46.100

Reputation: 1 629