1

I want to sync an entire drive's worth of files between my two Windows 10 computers, a desktop and a laptop. I want to be able to do so when I choose, i.e. by running a command from the command line.

If I delete a file on one computer, I want it to be deleted from the other as well. If I accidentally make changes to the same file on both computers, I want to be able to resolve the conflicts.

I want all this to happen over my local network, without going to the cloud. I want it to be able to handle ~50GiB of files. And I want the sync process to be as efficient as possible, not sending over files that the other computer already has copies of.

  • 1
    @Chenmunka It doesn't look like Robocopy lets you distinguish between files that you deleted on purpose (and want to delete on the other computer as well) vs. files that you deleted by accident, and want to restore. I guess that's the most easily identified drawback. – Stephen G Tuggy Jul 3 '16 at 22:34
1

I decided to use Git. Specifically the 64-bit Windows version of Git. The 32-bit version would use up the entire 32-bit address space, then die.

I have both computers connected to the same DSL router using Gigabit, wired Ethernet cables. I found that this made syncing much faster than using wireless for both, or wired for one and wireless for the other. Your results may vary.

Note that syncing an entire drive at once didn't really work. I had to split it up by subfolders. I.e. instead of:

E:\

I split it up into:

E:\Users\Public
E:\Users\<My User Name>

Etc.

To install Git and keep it up to date, I am using Chocolatey. To install Git initially:

choco install git

...from a Windows PowerShell window with Administrator privileges.

To check for and install any Git updates:

choco upgrade all

...again, from a PowerShell window with Administrator privileges.

Let's call my desktop computer DESKTOP-PC, and my laptop LAPTOP-PC. (Not their real machine names.) Now, once Git was installed on both machines, I rebooted them both. Then, on DESKTOP-PC, I created a .gitignore file under E:\Users\Public, in order to tell Git to ignore certain files and folders, such as Recycle Bin, System Volume Information, and *.tmp.

Next, I ran the following from a non-administrator PowerShell window:

cd E:\Users\Public
git init
git add .
git commit -m "Initial Commit"

I then shared my E: drive over the network as \DESKTOP-PC\e. I used Advanced Sharing instead of the Sharing Wizard. I deleted the default permissions for Everyone, and instead added a permission entry for my user specifically, with full permissions.

Next, I switched over to LAPTOP-PC. LAPTOP-PC doesn't have an E: drive. So instead, I created a folder called C:\E_Users. Then I opened a PowerShell window, without Administrator privileges, and ran the following:

git clone file://///DESKTOP-PC/e/Users/Public

This copied all the files over from DESKTOP-PC to LAPTOP-PC. There were maybe ~30GiB worth of files, so it took a few minutes. (file:///// is the Unix/Linux-compatible way of referring to the UNC path \.... This allows me to use Git Bash at times if I want to, instead of Windows Command Prompt or Windows PowerShell.)

The next step was to share LAPTOP-PC's C:\E_Users folder on the network as \E5-772G\E_Users. I set this up with the same permissions as the shared folder on DESKTOP-PC. (Note that this probably wouldn't have worked if I didn't have the same username and password on both PCs.)

Next, I switched back over to DESKTOP-PC. Still in PowerShell, I ran the following:

git remote add LAPTOP-PC file://///LAPTOP-PC/E_Users/Public
git fetch --all
git branch --set-upstream-to=LAPTOP-PC/master master
git pull --all

All set up. Now, anytime I add, change, or delete any files on DESKTOP-PC, I open PowerShell or Git Bash, switch to the proper directory, and run:

git status

to see exactly what files I have changed. Then:

git add .
git status
git commit -m "<Brief, present-tense description of the changes I made>"

This registers my latest changes with Git. Then I switch over to LAPTOP-PC, and run:

git pull --all --prune

This pulls my latest changes from DESKTOP-PC across to LAPTOP-PC.

Finally, I switch back over to DESKTOP-PC, and run:

git pull --all --prune

again. Now Git on DESKTOP-PC knows that LAPTOP-PC has all the latest changes.

(I found that pulling worked better than pushing, for whatever reason.)

If I change some files on LAPTOP-PC, the process is the same as the above, except that I swap which computer I run what command on in what order.

I hope this helps somebody!

  • 1
    Personally, I would have gone with Bvckup2, or maybe Bit Torrent Sync, but if you're happy, that's the main thing. After 2 days, you can accept your own answer, which will help others reading this in future. – Mawg Mar 2 '17 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.