18

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.
Ansgar Wiechers
  • 175,025
  • 22
  • 204
  • 278
Sun_Sparxz
  • 941
  • 2
  • 12
  • 24
  • I see lots of powershell tags, but this isn't a powershell question. – Mike Shepard Apr 19 '13 at 16:16
  • I found this question quite to the point, yet no answer was marked as the correct answer and yet the solution seems to be buried in a comment ?! I'd rather not start a new response and steal the credit from @Ansgar Wiegers but the solution seems to be to use the `/XX` switch. (see below) – deroby Sep 23 '15 at 10:18
  • @Sun_Sparxz : would you mind marking an answer, or do you think there is no good one currently ? – Mat M Nov 03 '15 at 20:58

7 Answers7

25

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
Ansgar Wiechers
  • 175,025
  • 22
  • 204
  • 278
  • 1
    This is true but when /E option is used to recurse the sub-directories, all of those are listed and have to be suppressed by /NDL. – amit_g May 26 '13 at 19:17
  • 1
    If I'm not mistaken I did suggest using `/ndl`. – Ansgar Wiechers May 26 '13 at 23:22
  • Yes, I just wanted to clarify as it wasn't clear to me just by reading it i.e. when to use /ndl. Thanks for the answer. Upvoted already. – amit_g May 27 '13 at 02:09
  • 1
    I asked for solution to avoid exiting file details from destination folder in each robocopy log file. not to avoid the robocopy log header information. my case was to avoid listing out all existing file detail "*EXTRA File" list from robocopy log. because i need to keep moving files to destination daily around 1000 + and if all existing details would list in the robocopy log, it will take time to open the log file itself – Sun_Sparxz Aug 14 '13 at 15:43
  • 2
    You should be more specific about what you mean by "existing file details" then. Extra files are excluded via `/xx`. – Ansgar Wiechers Aug 14 '13 at 17:10
  • 1
    using the /xx option changes what actions are taken (it negates /MIR switch so that it becomes the /S switch instead) – BeowulfNode42 Sep 03 '13 at 23:07
  • @BeowulfNode42 Nobody except you said anything about `/mir`. Besides, it's quite obvious that `/xx` would modify `/mir` (which is the same as `/e /purge`), since you cannot ignore *and* purge extra files at the same time. – Ansgar Wiechers Sep 03 '13 at 23:37
  • Note that there is a [long standing bug](https://social.technet.microsoft.com/Forums/windows/en-US/e8c38fe1-df36-4dfc-8dd5-50613b1a7984/robocopys-mt-option-disables-np-option) in Robocopy, reported in 2009, where `/NP` is ignored if `/MT` is used. This will generate "100%" messages in your log file even when `/NFL` is used. – Ross Presser Jan 19 '15 at 15:56
5

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

Official reference

Readable reference

Mat M
  • 1,438
  • 17
  • 26
3

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.

AbsoluteƵERØ
  • 7,509
  • 1
  • 22
  • 34
  • I don't see any requirement for `/v` in his question. – Ansgar Wiechers Apr 19 '13 at 19:19
  • 1
    @Ansgar Wiechers I had an idea of `robocopy a b /v > log.txt` but it would still show the skipped lines. Was an internal thought that somehow got communicated here. – AbsoluteƵERØ Apr 19 '13 at 20:33
  • @Ansgar Wiechers I'm always running `rsync` in FreeBSD which looks similar on screen while it's running but it does not show the non-copied files with the `-v` option. Had them confused for a sec. – AbsoluteƵERØ Apr 19 '13 at 20:40
2

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

Sun_Sparxz
  • 941
  • 2
  • 12
  • 24
  • With /E option the directories are listed. That can be suppressed with /NDL and then only files that are copied or changed are listed. – amit_g May 26 '13 at 19:15
  • Right now i use this "C:\Windows\System32\Robocopy.exe $source $dest /EFSRAW /MOV /TS /np /LOG+:$LogFilePath" after that im doing the above line deletion. It will be great if you share how to add option what you said. I tried, but its not displaying the file information about the files getting copied even, – Sun_Sparxz May 28 '13 at 13:55
1

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
  • 780
  • 9
  • 18
1

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.

HeedfulCrayon
  • 779
  • 5
  • 20
Craig C
  • 11
  • 1
0

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

Daniel Mošmondor
  • 19,070
  • 12
  • 53
  • 95