1

I would like to mirror a directory with robocopy without any output except for the status header and the summary at the end. The command I am using at the moment is robocopy /MIR /NFL /NDL /NC /NS /NP dir1 dir2. If I create a file in dir2 that is not present in dir1 and run this command it gets deleted (as expected) but also generates output (not expected and not wanted). Is there a way to make robocopy behave like I want?

Edit: I still want to see the Job Header and Job Summary though.

tim
  • 407
  • 6
  • 16
  • Unfortunately, the only way seems to be to pipe the output, e.g. `robocopy /MIR /NFL /NDL dir1 dir2 | Select-String -Pattern "*EXTRA" -NotMatch -SimpleMatch` in PowerShell, or `robocopy /MIR /NFL /NDL dir1 dir2 | findstr /lv "*EXTRA"` in CMD. – tomasz86 Jul 06 '22 at 17:26

1 Answers1

2

Yes, you can redirect the output (Stream 1 for Standard Output, Stream 2 for Error output) either to NUL (just disregard it) or to a file (for later viewing):

robocopy /MIR /NFL /NDL /NC /NS /NP dir1 dir2 >nul 2>&1

or

robocopy /MIR /NFL /NDL /NC /NS /NP dir1 dir2 >robolog.txt 2>&1
Stephan
  • 53,940
  • 10
  • 58
  • 91
  • But I would like to still be able to get the Job Header and Job summary though.. Sorry I was probably not that clear in my question. – tim Nov 08 '17 at 11:02
  • I haven't found a way to silence the deleted files either. Had to settle for >nul which in my case is okay. – spryce Feb 01 '21 at 04:40