How To Force Microsoft OneDrive To Sync More Often

How To Force Microsoft OneDrive To Sync More Often

I use a number of different cloud storage services for different purposes, because they each have certain advantages and disadvantages. What I like about Microsoft OneDrive is that it has a relatively small memory footprint and doesn’t bog down the system like other cloud storage clients that constantly run in the background.

Cloud Storage Provider Memory Usage*
BoxSync 107.964K
Dropbox 89.120K
OneDrive 2.860K

*measured while uploading

However, one problem that I’ve found with OneDrive is that it’s sometimes really slow to sync. Let’s say I work on a document on my laptop, then a few minutes later move to the sofa and try to pull up the file on the tablet … no luck, because OneDrive seems to sync files only once in a millenium.

I looked for a “sync now” button everywhere but came up empty. Scouring official forums, there were many people who had the same question but only canned answers.

Sometimes, even after a few hours or days (without reboot), OneDrive still hadn’t noticed and synced my changes. And what’s the use of a cloud storage system that is always days behind?

Have You Tried Turning it Off and On Again?

Now … it turns out that if you quickly close the client (or kill the process), and then restart it again, OneDrive wakes from its slumber, starts analyzing the changes and begins to sync!

So now, whenever I want to make sure that OneDrive syncs my changes before I move to a different device, I simply need to kill and restart the client. Here’s a simple batch script to automate that process:

@echo off
taskkill /f /im onedrive.exe
start %localappdata%\Microsoft\OneDrive\OneDrive.exe /background

Just (adapt and) paste this code into Notepad, save it as sync.bat or something and then, whenever you want to give OneDrive a whack on the head gentle reminder to sync your files, running the script will kill and restart the process for you.

On top of that you can also use Task Manager to run this script once per day or something.

The only downside that I’ve found with this is that once OneDrive restarts it pops up an explorer window of the folder, which is a minor annoyance, yet it still would be preferable not to require another action (close folder).

UPDATE: I’ve updated the above script so that no windows pop up anymore. Thanks Samuel for the hint about “/background” which I hadn’t been aware of.

It’s not perfect, but until Microsoft inserts a “sync now” button or just makes the syncing process more real-time, it’s better than nothing.

UPDATE: Apparently, there is a native manual sync option after all, but only in the Windows 8 OneDrive app, not in the Windows 7 client. Read more here. Thanks Joe for the tip-off.

onedrive_sync3

UPDATE: Another interesting way to force OneDrive to sync without closing the client just reached me via email. Thanks Rudi! Here’s how it works: Drop a simple text file in your OneDrive folder. Now, whenever you make a change to that file, i.e. edit and save it, OneDrive will sync all your files.

Curiously though, this only works when the text file is in the main OneDrive folder. I tried updating a text file on my desktop (which is included via Symbolic Link in my OneDrive folder) and that didn’t do the trick.

How To Force OneDrive To Sync When Your Computer Wakes Up

For the past couple of months I’ve been using Windows Task Scheduler to start the above script once per day. However, I still sometimes found myself missing newly updated files when the changes were made before or after the scheduled time. Since I’m working on a laptop most of the time and my working sessions are started and ended with opening and closing the lid, I started looking for a way to run the above script whenever I open my computer. Here’s how it works.

    1. Start Windows Task Scheduler
    2. Create a New Task
    3. Under Triggers, Click “New”
      onedrive-sync1
    4. Select “On an event” from the “Begin the task” dropdown menu. Then select “Custom” and click on “New Event Filter”.
      onedrive-sync2
    5. In the popup, select XML and post the code below into the box:
      onedrive-sync3
<QueryList>
 <Query Id="0" Path="System">
 <Select Path="System">*[System[Provider[@Name='Microsoft-Windows-Power-Troubleshooter'] and (Level=4 or Level=0) and (EventID=1)]]</Select>
 </Query>
</QueryList>

Now, under “Actions” simply configure your task to run the batch script I’ve talked about in the beginning of the post and you’re good to go. Your computer will now force OneDrive to sync whenever it wakes up.