primavilla.blogg.se

Use robocopy to sync folders
Use robocopy to sync folders










The files that will always be "older", are files that have a created date, but not a modified or accessed, interpreted as " 12:00:00 AM" UTC. I don't think this is a permission problem, this is a file timestamp problem.

Use robocopy to sync folders windows#

I am concerned that my data copy is not accurate.Īny known problems with robocopy or differences between windows handling of names and unraid handling of names of SMB? Is this an unraid / SMB timestamp problem?

use robocopy to sync folders use robocopy to sync folders

When I looked at two files where the timestamps were wrong, I can see that the unraid timestamps is not the same as that of the W2K16 server. It is as if the file timestamps are even less granular then /FFT, or the file timestamps get changed by unraid after copy, invalidating the previous operation. Same as the directory that does not delete, I can run robocopy clean, run it again, and it will copy a bunch of files again. I am using the fat file time /FFT option to work around the lack of nanosecond granularity on EXT4/XFS vs. When I rerun robocopy, I will get the hundreds of files being reported as older on unraid, when those files have never been changed. See the attached image, the directory on Unraid is there, but there are also directories that are not syncing, the "LocalState." directory, note the double dots on the end of the folder name. While "rd \\Unraid\backup\Profiles\SZ170R6V2\piete\AppData\Local\Packages\_cw5n1h2txyewy\L8EVMY~1\" does delete the folder. I can run robocopy over and over, and that same directory will never delete. *EXTRA Dir -1 \\Unraid\backup\Profiles\SZ170R6V2\piete\AppData\Local\Packages\_cw5n1h2txyewy\L8EVMY~1\ Options : *.* /FFT /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /MT:8 /R:1 /W:1 I noticed a problem where it appears that the files and folders are not being correctly synced.Ĭ:\Users\Administrator\Desktop>robocopy.exe D:\Backup \\Unraid\backup /mir /r:1 /w:1 /fft /mt If you are looking at my script, how it works is pretty self-evident.I am copying files from my W2K16 server to Unraid using robocopy over SMB. The Net Use command allows you to mount a remote share as if it were a local drive on the system. Once you are done, your destination should match your source darn near perfectly. Robocopy will not only copy all new or changed files from the source, it will also delete any files or folders at the destination that are not present in the source. In this case I am using the mirror flag, denoted by “/MIR.” Mirror is excellent if you want a perfect sync of files and folders between source and destination. It has a slew of flags that can be used to do various things with the copy operation. Robocopy is an excellent tools for copying files from one place to another. In this case, I added a 10 second delay to ensure the shares are mounted before the rest of the script runs. Sometimes you might need to put a delay in your script. This stops the script from running and prompts the user to hit a key before it will continue on, which can be useful if you want them to check on what the script is doing as it moves along. Throughout the script you will see “Pause” written. This isn’t a very good script for automation, it was meant to be run manually. Anytime your path contains spaces, make sure you wrap it in quotation marks. To get around this, we wrap our paths in double-quotes and this tells our command that everything inside is part of the path, exactly as written. The reason for this is because often times, especially in the Microsoft world, you will run into folders with spaces in their names. You may have noticed I use double-quote marks around all of my paths. I am not going to walk through the entire script, but I am going to point out some of the bits and pieces that are important… First, general batch file syntax stuff… Second, sometimes it is hard to find good examples of commands so you can figure out proper syntax and having something like this can help a lot. The reason I provide scripts like this? Well, first, I am archiving them here for myself. Robocopy "Y:\Yet Another Folder 2" "D:\differentpath\longerpath\Yet Another Folder 2" /MIR

use robocopy to sync folders

Robocopy "Y:\Another Folder 1" "D:\differentpath\longerpath\Another Folder 1" /MIR Robocopy "X:\CoolFolder2" "D:\path\CoolFolder 2" /MIR Robocopy "X:\Folder 1" "D:\path\Folder 1" /MIR Echo First we will mount our shares to drive X and Y










Use robocopy to sync folders