How do I remove skipped files from output of robocopy? - robocopy

I have a drive with several TB of data, most of which doesn't change often. When I run robocopy the spew contains reams and reams of skipped files. I'd like to run /L to see what will be copied and what will be deleted before mirroring to my backup drive, but there is so much noise in the log due to the skipped files that sorting through it is time-consuming.
How do I tell robocopy to log only those files that are copied or deleted?

i have found this switch useful to reduce the amount of unnecessary output
/ndl Specifies that directory names are not to be logged.
All robocopy Parameters

Related

Robocopy with logs

I want to use robocopy for one copying work where whole directory and it's subdirectories with files needs to be copied, but also the log files must contains the logs of copied as well skipped files details. I was using below command robocopy src dest /e /logs:dest
But it's not working for me, can anyone please suggest the required command that can be used for this purpose. Thanks.

How to perform two ROBOCOPY statements from one source folder to two destination folders in one batch file?

I have an interesting situation where I'd like to move some files from directory X to directory Y, but in order to MOVE the files without deleting the source folder, I created a log statement in said folder. A very simple version of what I'm doing is this:
robocopy
"C:\Desktop\Origin" "C:\Desktop\Destination"
/e /move /XF "C:\Desktop\Origin\test.log"
/log:"C:\Desktop\Origin\test.log"
This results in the moving of all files in "Origin" directory to "Destination" directory, and doesn't get rid of the "Origin" directory, as the "/e /move" flags normally would. Now, if I didn't want that log file, I could simply add this line to the code:
del "C:\Desktop\Origin\test.log"
But, I actually do want to keep this log file. I just want it somewhere else. So what I've been trying to do is to move it to directory Z with "/e /mov" or even just "/s" and then the delete. For example:
robocopy
"C:\Desktop\Origin" "C:\Desktop\Destination"
/e /move /XF "C:\Desktop\Origin\test.log"
/log:"C:\Desktop\Origin\test.log"
robocopy
"C:\Desktop\Origin" "C:\Desktop\Destination 2"
/s
del "C:\Desktop\Origin\test.log"
But after trying multiple times, with multiple little variations, nothing seems to happen. The first robocopy happens, but the second doesn't seem to happen at all. It seems like multiple robocopy statements can run in one batch file (which is what I want) but perhaps not from the same source directory. Does anyone know why this is the case and also how I can achieve my stated goal? Thanks!
Thanks to the suggestion of Ken White, I found a solution to this. If you use MOVE.EXE, it works just as expected.
robocopy
"C:\Desktop\Origin" "C:\Desktop\Destination"
/e /move /XF "C:\Desktop\Origin\test.log"
/log:"C:\Desktop\Origin\test.log"
move
"C:\Desktop\Origin\test.log" "C:\Desktop\Destination 2"
One thing to note is that you can't use /LOG+: with this method, since you'd be writing the log file to a location where no log file exists, since it had been moved previously to "Destination 2". However, even the normal log files include the *EXTRA files already in the directory.

Robocopy: Copy file, and if an identical file name exists in destination, keep BOTH

I've got this line of code using Robocopy:
Robocopy C:\Autopilot_Export \\Zapp\pc\PLI\Hash_Exports Autopilot_CSV.csv
I will have multiple computers networked into this server running this same script and they'll be copying different CSVs under the same CSV name "Autopilot_CSV".
Is there a way to have Robocopy behave similarly to how Windows 10 does when you copy an identical file to a directory and hit "Keep Both" when prompted? So it would end up naming them Autopilot_CSV.csv, Autopilot_CSV(1).csv, Autopilot_CSV(2).csv, Autopilot_CSV(3).csv, and so on...
I've looked over the Robocopy documentation and found the /XN /XO /XE options, but they appear to all be referencing timestamps, differing sizes, older, and newer files. The timestamps and sizes of these files are going to all be different, however, the file names will be the same.
Is there a way to do this?
Thanks!

Created copy taking too much free space

I found a problem using robocopy in PowerShell. I used this tool to backup files from one disk (around 220GB) using command:
robocopy $source $destination /s /mt:8
The problem is that created copy took a lot of free space in the destination location (I stopped making backup when it reached around 850GB). Does anyone know why it has happened?
May be there're some loops involved.
robocopy has
Ability to skip NTFS junction points which can cause copying failures because of infinite loops
Try to run with /XJ flag or simply list/log what files are copied to check for loops
See robocopy help and
post about it
UP For those who faces same problem:
there were infinite loops which I found using WinDirStat. Mostly it were Application Data/Documments and Settings/Users folders

Scheduled task : Error 0X3 but Log doesn't give any error

I have several tasks using Robocopy.exe, On One of those tasks, I get a error result 0X3 but the log file doesn't display any error.
Here is the command :
ROBOCOPY \\X\L$\FORMATION \\Y\O$\FORMATION /MIR /sec /W:2 /R:5 /log:c:\O_journal.log
I tried to launch it without the task scheduler, it worked fine without ant errors.
I know that the error 0X3 is : ERROR_PATH_NOT_FOUND.But the log file doesn't display any error.
If someone have any clue or any methods...
This is a standard behavior and relates to exit codes from Robocopy:
0×00 0 No errors occurred, and no copying was done.
The source and destination directory trees are completely synchronized.
0×01 1 One or more files were copied successfully (that is, new files have arrived).
0×02 2 Some Extra files or directories were detected. No files were copied
Examine the output log for details.
0×04 4 Some Mismatched files or directories were detected.
Examine the output log. Housekeeping might be required.
0×08 8 Some files or directories could not be copied
(copy errors occurred and the retry limit was exceeded).
Check these errors further.
0×10 16 Serious error. Robocopy did not copy any files.
Either a usage error or an error due to insufficient access privileges
on the source or destination directories.
And a combination of them, ie: 0x03 = 0x02 + 0x01
See https://blogs.technet.microsoft.com/deploymentguys/2008/06/16/robocopy-exit-codes/ for a complete explanation.
This is an issue to the path configured on the robocopy script. I have fixed this issue by adding the root directory or the main drive to both source and destination.
Note: Please make sure that you are an administrator to both Servers (source and destination)
Example:
Source: "\\192.168.1.2\e$\my files"
Destination: "\\192.168.1.5\d$\backup"
The root directory or the main drive that I have referred is the "e$" and "d$" as shown above. If this will not included in your script, you will be encountering the "0X3" error in the Scheduler and the scheduler will not works.
Note: This script is to synchronize/replicate the file from the source to destination.
Parameters used. /MIR /E /Z /R:5 /W:5
This is how the script looks as a whole:
robocopy "\\\192.168.1.2\e$\my files" "\\\192.168.1.5\d$\backup" /MIR /E /Z /R:5 /W:5
Hope this might help.
Thanks.
Xian