Originally, I was using SyncToy to keep my main multimedia library in sync with the network drive library.  But for inexplicable reasons, SyncToy has been running monstrously slow ever since I upgraded to Windows 7 and Windows 8. Since Microsoft stopped supporting SyncToy about four years ago, it’s unlikely that it’ll be fixed. So, I’ve started using Robocopy instead. And so far, it works great. I can sync a folder pair consisting of my main photo library and a folder on my network drive. And like with SyncToy, Robocopy will also delete files on the network drive that no longer exists in my collection. Best of all, Robocopy is free (it comes built-in to Windows).

Use Robocopy Command Line Tool

Robocopy is a command line tool. To mirror a folder to another folder (in my case, the folder on my network drive), use the following switches: robocopy source_directory target_directory /MIR Replace source_directory and target_directory with the appropriate folder paths. Note that you’ll have to wrap it in quotes if there are spaces in the folder path. That’s the basic command you’ll need. It only has one switch: /MIR. /MIR is a combination of the /e and /purge switches, which, collectively, copy all subdirectories (including empty subdirectories) and delete files and directories that no longer exist in the source directory. /MIR also overwrites the directory security settings (unlike /e) if the directory already exists. Simply type the above command into cmd.exe to make it happen.

The progress of the file copy will be shown in the command window. Afterward, you’ll get a summary of the files transferred. Here, you’ll see that 2 files were copied and 1 was deleted because it didn’t exist in the source directory. Only 1 directory was copied because the other directory was the root, which already existed.

To save yourself the trouble of typing that in each time you import photos to your library, you can copy and paste the command into Notepad and save it with the .bat extension.

Then, all you have to do is double-click it to run it.

With a batch file, you can also automate it to run once a week, daily, etc. similar to my earlier tip on how to automatically wake and sleep your computer using Windows Task Scheduler. Just sub out the wake.bat and sleep.bat for mirror.bat.

Other Switches and Tweaks

There are two other switches I use with my Robocopy mirror batch file. The first is the /z switch. This enables Restart mode, which lets you resume a large transfer if it’s been interrupted. With large movie files, this may come in handy. But with network drives, it does slow things down a bit. The other one I use is /LOG. This writes the status of the transfer to a log file, rather than displaying it in the command prompt. This is handy when the transfer runs automatically when I’m away, so I can go back and view it. I save the log in my Dropbox folder, so I can view it from my phone or another computer to see if the transfer occurred. My entire batch file looks like this:

Conclusion

Overall, Robocopy has been working well for me. It keeps my files in sync so they are available to all the devices on my network. And it seems to be considerably faster than SyncToy. Usually, I sync right away whenever I do an import, but if I forget, it runs once a day at 5 AM (which is about 15 minutes before I sit down at my computer first thing in the morning). Also, this will work much better for you if you use one directory for your photos and videos. If you have multiple directories, things can get a little more complex. But it could be as simple as running multiple Robocopy commands (one for each folder pair to keep in sync). What do you use to mirror files to your network drive? Let us know in the comments! Total Copied Skipped Mismatch FAILED Extras Dirs : 793 2 791 0 0 0 Files : 16711 46 16665 0 0 0 Bytes : 118.058 g 279.28 m 117.785 g 0 0 0 Times : 0:09:49 0:06:24 0:00:00 0:03:24 Are you using all the switches? robocopy “E:\Storage\Photos and Videos” “Z:\photos and videos” /MIR /Z /LOG:mirror.log F:\Marcs Documents\PC Stuff\macros>robocopy “f:\marcs pictures\2013 pictures\Gracienne” “t:\2013 pictures\Gracienne” /MIR ——————————————————————————- ROBOCOPY :: Robust File Copy for Windows ——————————————————————————- Started : Tuesday, April 16, 2013 6:49:11 AM Source : f:\marcs pictures\2013 pictures\Gracienne\ Dest : t:\2013 pictures\Gracienne
Files : . Options : . /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /R:1000000 /W:30 —————————————————————————— 5 f:\marcs pictures\2013 pictures\Gracienne\ 100% Newer 17.3 m Moviea.wmv 99% Newer 138242 photo.JPG Modified 117789 photoa.JPG 99% Newer 87243 photob.JPG 99% Newer 430604 tthotoa.JPG —————————————————————————— Total Copied Skipped Mismatch FAILED Extras Dirs : 1 0 0 0 0 0 Files : 5 5 0 0 0 0 Bytes : 18.08 m 18.08 m 0 0 0 0 Times : 0:00:09 0:00:09 0:00:00 0:00:00 Speed : 2106881 Bytes/sec. Speed : 120.556 MegaBytes/min. Ended : Tuesday, April 16, 2013 6:49:20 AM F:\Marcs Documents\PC Stuff\macros>pause Press any key to continue . . . Also, what is T: mapped to? Could it be a cloud drive? Not sure if Robocopy could play well with the cloud…

  1. Install FFS and Linkey, and set homepage, and a load of other stuff to it 2. Install FFS and Linkey, but don’t set homepage and other stuff to use it (BUT STILL INSTALL IT!) 3. Install nothing – neither FFS or Linkey The installer is clearly designed to fool the skim-reader into thinking that option 2 (custom) is to install FFS but not Linkey – it is not. Always read every word of the installer for free software! But robocopy looks absolutely perfect – thank you very much for the guide. So good FYI on the FFS junk. Good reminder for everyone to READ THE FINE PRINT! Thnx for reading my blog. -S –file name RoboCopy.bat –content robocopy “C:\ProgramData\ElectricSheep\content” “\WDMYCLOUD\SmartWare\Electric Sheep” /MIR /Z /LOG:mirror.log robocopy “\WDMYCLOUD\SmartWare\Electric Sheep” “\FRED-505\ElectricSheepContent” /MIR /Z /LOG:mirror.log robocopy “\FRED-505\ElectricSheepContent” C:\ProgramData\ElectricSheep\content” /MIR /Z /LOG:mirror.log Copy c:\SharedData\Test.txt c:\Junk\Test.txt This works fine. Then I simply add Robo to the front and try to execute again: RoboCopy c:\SharedData\Test.txt c:\Junk\Test.txt Win7 complains “ERROR 123 Accessing source directory. Filename, directory name or volume label syntax is incorrect.” Any idea what I’m doing wrong? It seems too simple to be wrong, but… robocopy “E:\Storage\Photos and Videos” “Z:\photos and videos” /MIR ^^^^ robocopy “\WDMYCLOUD-6TB1\Public\Shared Videos\Z” “\WDMYCLOUD-6TB2\Public\Shared Videos\Z” /copy:dt /mir /z /log:C:\Users\Andrew\Desktop\mirror.log /tee /np But it does seem to just work for directories. Here it is, as one of the folder path does not have spaces I did not wrap it in quotes. robocopy C:\Users\s176026\Documents\Screenshot-Confirmations “C:\Users\s176026\Desktop\test\test once more” /MIR /Z /LOG:mirror.log Is this correct? Thank you in advance Comment Name * Email *

Δ  Save my name and email and send me emails as new comments are made to this post.

Automatically Mirror Files in Windows to a Network Drive with Robocopy - 22Automatically Mirror Files in Windows to a Network Drive with Robocopy - 54Automatically Mirror Files in Windows to a Network Drive with Robocopy - 13Automatically Mirror Files in Windows to a Network Drive with Robocopy - 46Automatically Mirror Files in Windows to a Network Drive with Robocopy - 37Automatically Mirror Files in Windows to a Network Drive with Robocopy - 92Automatically Mirror Files in Windows to a Network Drive with Robocopy - 73