I'm working with robocopy for the first time and have got most of it figured out and working well except logging.
I have experimented a bunch and if I run my job like this:
robocopy /xc /xn /xo "source" "destination" *.* /COPY:DAT /E
I see my job running line by line in the powershell console.
If I run it like this:
robocopy /xc /xn /xo "source" "destination" *.* /COPY:DAT /E /L LOG:mylogfile.log
I get a "dry run" file showing me what will happen when I run it "for real"
And when I run it like this:
robocopy /xc /xn /xo "source" "destination" *.* /COPY:DAT /E /LOG:mylogfile.log
The job executes, but I do not see anything on the console except:
Log File : mylogfile.log
with a blinking cursor until the job is done. Once the job completes, then I can see the results in my log.
My understanding is robocopy does not create a log by default. My question is, is there a way to have both the console showing the line by line progress like my 1st set of commands above AND log the job to a file like my 3rd set of commands all in one run?
Best Answer
Looks like you need some tee. (Not the drinkable variety although you might enjoy a cup of that too while robocopy does its thing. :)
(Or just type powershell and then at the PS prompt type your robocopy command piped via tee to the log file.)
Edit: Ok, now I just feel dumb, because robocopy has an in-built /tee parameter that I can't believe I never noticed earlier.