The Computer Oracle

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

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Over a Mysterious Island

--

Chapters
00:00 How Do I Hide &Quot;Extra File&Quot; And &Quot;100%&Quot; Lines From Robocopy Output?
01:22 Accepted Answer Score 11
03:27 Answer 2 Score 11
03:47 Answer 3 Score 4
04:06 Answer 4 Score 0
05:11 Thank you

--

Full question
https://superuser.com/questions/511702/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows #robocopy

#avk47



ACCEPTED ANSWER

Score 11


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




ANSWER 2

Score 11


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.




ANSWER 3

Score 4


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".




ANSWER 4

Score 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.