question

GaryOsborne-7192 avatar image
0 Votes"
GaryOsborne-7192 asked GaryOsborne-7192 answered

Is there a way to get Robocopy ONLY log changed(copied) files and folders

I am using Robocopy to backup files to our server. This is great, except every session logs every file. Even those not copied. Is there a way to get Robocopy to only log files & folders it copies (this would seem to me to be an obvious feature). The /X option woudl seem to do the opposite.

windows-10-network
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hi there,

It is by design that Robcopy saves all logos in every session and I guess it cannot be changed. The only solution would be to create a different log file every day.

You can just call Robocopy in PowerShell or batch command file and do your file manipulation and have it create the log, then rename the log file on the next line.

Rename-Item -Path "C:\logs\robocopy.log" -NewName "robocopy-$(Get-Date -F yyyy.MM.dd)$($_.Extension).log"

The result will be a dated file like this:

robocopy-2022.04.28.log



--If the reply is helpful, please Upvote and Accept it as an answer–

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

GaryOsborne-7192 avatar image
0 Votes"
GaryOsborne-7192 answered

I have got to what I wanted by parsing the logfile: So...

robocopy sourcefolder targetfolder /e /np /ndl /nfl /fp > TMPrc.log
findstr /C:"New File" TMPrc.log > report.txt
findstr /C:"New Dir" TMPrc.log >> report.txt
findstr /C:"Extra File" TMPrc.log>> report.txt
findstr /C:"Extra Dir" TMPrc.log >> report.txt

This gives me only a list of changed files & folders in report.txt

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.