Question

I would like to avoid all existing file names and details of destination folder while using Robocopy Log.

Just want to show only copied file list and its details.

So i could save on the robocopy log file size by avoiding existing file details on log.

Is there any option to avoid it, please help out on this

I could not see any option for that

Logging Options : ::

             /L :: List only - don't copy, timestamp or delete any files.
             /X :: report all eXtra files, not just those selected.
             /V :: produce Verbose output, showing skipped files.
            /TS :: include source file Time Stamps in the output.
            /FP :: include Full Pathname of files in the output.
         /BYTES :: Print sizes as bytes.

            /NS :: No Size - don't log file sizes.
            /NC :: No Class - don't log file classes.
           /NFL :: No File List - don't log file names.
           /NDL :: No Directory List - don't log directory names.

            /NP :: No Progress - don't display percentage copied.
           /ETA :: show Estimated Time of Arrival of copied files.

      /LOG:file :: output status to LOG file (overwrite existing log).
     /LOG+:file :: output status to LOG file (append to existing log).

   /UNILOG:file :: output status to LOG file as UNICODE (overwrite existing log).
  /UNILOG+:file :: output status to LOG file as UNICODE (append to existing log).

           /TEE :: output to console window, as well as the log file.

           /NJH :: No Job Header.
           /NJS :: No Job Summary.

       /UNICODE :: output status as UNICODE.
Was it helpful?

Solution

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

OTHER TIPS

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

Official reference

Readable reference

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.

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

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

I have seen that /XX also avoids removing the EXTRA files in the destination folder and for that reason it does not log the extra file info. Someone earlier above already said that /XX negates the /MIR option.

To try to cut through the noise; use robocopy /xx and it will NOT show the files that are already in the destination folder.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top