My home has many computers and many screens, but just one central library of photos, music, and videos. My main computer stores all my multimedia (and the backups). But rather than keeping my main computer on at all times (it’s a power-hungry mid-tower), I mirror my photos and videos to a network drive that’s plugged into my router. 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:
robocopy “E:\Storage\Photos and Videos” “Z:\photos and videos” /MIR /Z /LOG:mirror.log
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!