avoid existing file details of destination folder in Robocopy log

It looks like you can't based on this TechNet posting because even the /v output would still show skipped files.

Only option I can figure would be run a script on the log removing the skipped lines.


By default robocopy logs only folders and nonpresent/modified (i.e. copied) files.

          New Dir          2    C:\Temp\a\
100%        New File                   0        bar.txt
100%        New File                   0        foo.txt

You can suppress the logging of folders with the /ndl switch (in this case the copied files will be listed with their full path).

100%        New File                   0        C:\Temp\a\bar.txt
100%        New File                   0        C:\Temp\a\foo.txt

Modify just foo.txt and re-run robocopy a b /ndl and you get

100%        Newer                      3        C:\Temp\a\foo.txt

Add /njh and /njs to remove header and summary from the output. Add /np to remove progress indication (the percent value at the beginning of the output line). Add /xx to remove indication of extra files (files that exist only in the destination, but not in the source folder):

C:\Temp>robocopy a b /njh /njs /ndl /np

          *EXTRA File                  0        C:\Temp\b\baz.txt
            New File                   0        C:\Temp\a\bar.txt
            New File                   0        C:\Temp\a\foo.txt

C:\Temp>echo "foo" >a\bar.txt

C:\Temp>robocopy a b /njh /njs /ndl /np /l

          *EXTRA File                  0        C:\Temp\b\baz.txt
            Newer                      3        C:\Temp\a\bar.txt

C:\Temp>robocopy a b /njh /njs /ndl /np /xx /l

            Newer                      8        C:\Temp\a\bar.txt

You should use /NFL /NDL. They will remove all directory and file listings that are not part of robocopy actions.

Official reference

Readable reference


Finally I could not find any switches, chose to script in such a way to remove the existing file details line and set the file back with same file name after each robocopy completes

#To remove all Lines with string "Extra File"
 (Get-Content $LogPath)-replace '(.*Extra File).+' | Set-Content $LogPath 

#To remove all empty lines 
(Get-Content $LogPath) | Where-Object {$_ -match '\S'} | Set-Content $LogPath  

what I did in my log files for existing file details line starts with "Extra File" string, so i remove all those lines. But the line space remains. so I used another commmand to remove all empty lines.

Please contribute, any one got easy method for this

Tags:

Robocopy