office_onedrive

Office 365 OneDrive Offline Cache Size Problem

Office 365 offers 1TB of OneDrive storage to their subscribers for a fairly small fee and according to the rumors soon to be unlimited space. Excellent for backing up your family photos and videos, right? No!

So what’s the problem?

Even if we overlook the fact that the business version of OneDrive actually is a SharePoint site in disguise we have massive issues with uploading a couple of hundred gigs of content. That goes for the home version of OneDrive as well. My setup is pretty common, I run windows on a 512GB SSD and I have another disk on 2TB for storing photos & videos. I installed the application and started uploading ~300 GB photos and videos.

After a couple of hours the sync had failed miserably, the computer was barely workable due to the lack of space on the system disk. Turns out that Office 365 thinks it’s a good idea to create an offline cache in the user AppData-folder (located on the system drive) for every file.

The accepted solution according to the community is to delete the files manually or setting “Days to keep files in the office document cache” to 1. But I couldn’t even do the initial sync!?

My solution

As the files were uploaded we needed to make room on the system drive for new uploads. The cache is located under C:\Users\<user>\AppData\Local\Microsoft\Office\15.0\OfficeFileCache. I threw together a simple console program in 10 minutes that deletes cache files older than 5 minutes. I’ve made the source code and a compiled dist version available on github here. It could be a good idea to always run it as a service, but I’ll leave that for a later exercise. It’s very straightforward and not complicated at all, more importantly it does the job.

UPDATE

I changed the implementation so it runs as a windows service and it’s installed with a msi.

Hope it helps.

By the way…

I switched to google drive instead since the business version of onedrive just lists the files in a list á la sharepoint style. No thumbnails, no viewing images or playing videos in the browser, can’t even download an entire folder as a zip file. Pretty useless, just like sharepoint.

  • Cobus Taljaard

    Thank you for this – need it on my Windows tablet with a 32GB C drive!
    I installed the msi, but after getting the installation complete confirmation message, nothing happened and the service is not running.
    Double clicking on the installed exe gets me a message to install the service with installutil.exe and I don’t know how to do that.
    Am I doing something wrong?

    • ajden

      Hi, you don’t need to double click the exe or install it with installutil. It runs as a windows service and should start the next time you reboot your tablet. You can always start it manually by following these steps:

      Windows+R
      services.msc
      Press enter
      Find the service called “office cache cleaner”
      Right-click and select start.

      You’ll also need to set the path to your office cache. You’ll probably just need to change the username. Do do that follow these steps:

      Navigate to where the service is installed.
      Open the file that ends with .config, it has the same name as the exe, in notepad.
      Change the path to your path.
      Restart the service.

      You can see if it’s running correctly by examining the log.text in the same directory.

      Hope it helps I’ll put these detailed instructions on the github readme as soon as I’m at a computer.

      • Cobus Taljaard

        Thanks. A reboot did the job. From just over 4GB, I now have over 11GB space free on my 32GB C drive!

        • ajden

          Sweet! I’m glad it helped, spread the word! 😉

          • JonathonWatkins

            I installed it just now and rebooted a few times, but it doesn’t seem to be working. I updated the config path with my username and confirmed that is the correct location. The service is running, but the folder is growing steadily with no deletions taking place. Windows 7 64 bit fully patched. Any ideas?

          • ajden

            What does the log say? If the service starts correctly there should be a file named log.txt where the service is installed.

            Please respond in a new comment. This thread is too indented 🙂

  • ajden

    Just added Installation Instructions to https://github.com/ajtowf/OfficeCacheCleaner

  • JonathonWatkins

    Ajden, I just checked for patches, saw that it needed an update to the .NET framework, rebooted and now it’s working. Thank you very much. Appreciated.

    • ajden

      Ah of course that explains it. I definitely don’t have too compile the service targeting framework version 4.5.1 like I do now, I’ll change that as soon as I get time.

      And I’ll probably add a prerequisite check to the installer. Thanks for the heads up!

  • Hi, great idea ! But It does not work on my PC:.

    Logs says :

    Timestamp: 2015-01-21 4:14:46 PM

    Message: Deleted Totally 0 files this iteration

    Category: General

    Priority: -1

    EventId: 0

    Severity: Information

    Title:

    Machine: LENOVO-MLA

    App Domain: OfficeCacheCleanerService.exe

    ProcessId: 4212

    Process Name: C:Program Files (x86)Towfeek Solutions ABOffice Cache CleanerOfficeCacheCleanerService.exe

    Thread Name:

    Win32 ThreadId:4144

    Extended Properties:

    • ajden

      Well that’s just a log message that says that no files were deleted in that iteration.

      Do you have files older than 5 minutes in your cache?

      If you can find log posts that contains filenames with a guid and if the directory doesn’t contain files older than 5 minutes the cleaner is working.

      I can take a look if you upload the entire log to http://www.filedropper.com/ and share the link.

      • Well, I had files dated from January 12. So yes.

        http://www.filedropper.com/log_9

        • ajden

          Right, so the issue becomes obvious when I see this log post:

          (Message: Could not find a part of the path C:UsersAjdenAppDataLocalMicrosoftOffice15.0OfficeFileCache’.)

          You haven’t changed the path, since “Ajden” is my name 😉

          Check out the install instructions on the github page, and let me know if it starts working. https://github.com/ajtowf/OfficeCacheCleaner

          You’ll need to stop the service before you can change the path.

          Cheers!

        • ajden

          I just commited a new version of the cleaner that, it won’t keep logging that 0 files was deleted if the directory isn’t found, instead you’ll just see 1 log message.

          Thanks for the feedback!

  • Toon Vervoort

    Thank you so very much!

    I’m having terrible problems with the cache filling up my SSD needlessly.

    I’m very dissapointed with the limitations of Onedrive for Business as well. max 20.000 files and max filesize 2GB? That means I have to average 50MB / file in order to be able to fill up my 1TB they gave me? I have already put a bunch of my pictures on my personal NAS at home, because I reach the 20.000 file limit.

    I’m very, very dissapointed, also because the web version is rubbish. I was excited to see 1TB of web storage coming with my Office subscription, now – not so much.

    I’m trying your little software tool now!

    • Toon Vervoort

      Works fine. Saved me 20+GB in a heartbeat.
      One little issue: I’m not sure how often your program checks for files that need to be deleted, but it seems to me it’s quite often. Because my OneDrive restarts overy 15 minutes or so. It also automatically opens the OneDrive folder, which is kind of annoying while working.

      • ajden

        Excellent point, it’s in fact too often, every minute to be precise 😉 The reason for that is that I needed to clear the cache while uploading my images. Give me a minute and that option will be configurable.

        • Toon Vervoort

          Very nice. I set it now to run every 4 hours, and delete everything that is older than 5 minutes. Those settings make more sense when the greater part is already deleted.

          Thank you!

          PS: I’m still thinking about switching to another service though – too many disadvantages.

      • ajden

        I just commited a new version, you should now be able to find a parameter called CleanIntervalMinutes in OfficeCacheCleanerService.exe.config. Default is still every minute, but you can turn it up to whatever you feel is necessary.

        Hope it helps, cheers!

  • OHMMGT

    Ajden – been having the same issues with cache filling up my SSD. i followed your link and downloaded the msi file just fine. I went to configure the service by changing the username, as you stated. but when i went to do save as on the file to overide the existing file i received an error msg stating “access denied”. This is a personal computer, so i am the administrator. how do i get access to save this file properly?

    please help!

    • ajden

      Stop the service first if it’s already running. Perhaps you need run notepad with elevated privileges to save to c:Program files? Windows button, type cmd, right click, run as administrator, then start notepad and open the file. Good luck!

      • OHMMGT

        your instructions worked! it’s running now so we’ll see how it goes. will keep you posted if it doesn’t work.

        thanks for your help Ajden!

  • OHMMGT

    Ajden – i have a 5 month old Lenovo X1 Carbon w/256GB SSD. the laptop is normally very quiet, but lately i hear the fan running all the time. When i go to task manager to see what is running, i see that my CPU is running at 50%-90%. When i see what is causing this to be so high, i see that the major % is from Microsoft Office Document Cache Sync Client Interface. Currently my CPU is running at 48% and the MSODCSCI is running at 34%. Mind you, i have absolutely no other applications running other than google chrome, task manager and skype. Is this normal? Is there a way to fix this?

    I have the MS Office Upload Center – but i’m assuming this is mainly for One drive Business? The One Drive Business application seems to be more of a hassle than a benefit as it seems to slow my computer down.

    thoughts?

    • ajden

      I don’t have a simple answer for that, I’d recommend you to turn to your laptop vendor reseller or report it to Microsoft or even simpler, don’t use the one drive business applications. I don’t.

  • Thank you! I have been dreading replacing a perfectly good hard drive.

  • Stefan

    Hi Ajden,
    Thanks for your work! Important stuff and too bad MS is not fixing this. Only one issue I’m facing now after using that service: Whenever I open a doc, xls etc from the onedrive businness in an office application it would only open the program (not the file), so I have to open the file again from within the program which will then face me with the message, that my offline version is possibly outdated although it definitely isn’t.
    Any idea how that comes?

    Stefan

  • westiechick

    Thanks for pinpointing this issue. It enabled me to resolve the problem, albeit without installing your msi – I turned off alerts in SharePoint Workspace 2010. However, I’ve yet to see if that prevents the issue from coming back once I install OneDrive for Business… apparently we won’t get a choice in that regard 😉

  • Naveed Ahmed

    Excellent Blog and very helpful article. Have anyone found a way to move the OfficeFileCache to D drive or some other drive ?

  • Roger Dodger

    Hi, Ajden. I’m sorry, but I’m not as technical as most people on this thread. I had a couple of questions:

    1) This solution appears to have been created for OneDrive for Business. I have OneDrive Personal and I’m experiencing this issue with the large OfficeFileCache folder on my SSD drive. Will this solution work for OD Personal? It appears that it should.

    2) Do you have a solution to move the OfficeFileCache folder to another drive? I’d like to move it from C to D.

    Thanks.

    Roger

    • ajden

      1) It’s actually made for onedrive personal, should work with business as well though.
      2) No, can’t move it, that’s how the sync client works, can’t change where it writes or looks for sync files unless they provide that option in a newer sync client.

      • Roger Dodger

        Okay, this sounds promising.

        So, now I want to install your program. I went to https://github.com/ajtowf/OfficeCacheCleaner, but there are 7 files/folders listed (see uploaded image). Where do I start? The installation instructions say “After installing the MSI, you need to configure the service and start it.” Which one is the MSI?

        Sorry for being such a pain.

        Roger

        • ajden
          • Roger Dodger

            Ajden,

            That worked! You’re awesome. I started the process to run every 10 minutes. I was watching the folder and the files disappeared. It was beautiful.

            Now, here’s something strange. I had stopped the OneDrive sync until I could get this issue fixed. Once the files were gone, I started up the sync again with your program running in the background. The files never returned. I was even syncing many more files. I was expecting to see files pop up and then get deleted 10 minutes later. It never happened. Just to be sure, I stopped your program to make sure that it was not deleting the files (and I just had not noticed the deletion taking place). The cache files never came back. Did Microsoft fix this issue???

            Roger