I've become very annoyed that my Vim temp files "can't be synced with OneDrive." I'd rather it just ignore them all together using regex or something, but I don't know how to do that.

  • Can you add the whole folder as ignored, or is that not a feasible option?
    – DrZoo
    Commented Mar 30, 2019 at 1:29
  • No, it's individual files, I guess I can turn them off, but it'd be better just to ignore them.
    – leeand00
    Commented Apr 1, 2019 at 14:12
  • The answer below gives details for Windows, as asked, but in case anyone is looking for MacOS, the equivalent approach/link is here: learn.microsoft.com/en-us/sharepoint/… Commented Jan 6, 2023 at 14:37

2 Answers 2


Edit 17 May 2022:

Microsoft has since added this feature and has written a how-to: Link

Original answer:

As of Onedrive 20.201.xxx and later, this is possible. Granted, there are a few caveats and it is not as easy as .gitignore. I found a guide here, but it was quite brief and presumed a lot of knowledge.

First things first, here are the prerequisites:

  1. OneDrive version 20.201 and higher
  2. Windows Pro/Education or any Windows that has a Group Policy Editor
  3. Administrative Rights on the Windows Machine as you need access to C:/Windows
  4. This must also be the OneDrive Client. You can still upload the blocked file types via the web interface(!)


  1. Go to %localappdata%Microsoft/OneDrive/<VersionNumber>/adm
  2. In there, copy the OneDrive.adml and OneDrive.admx files.
  3. Navigate to C:/Windows/PolicyDefintions and paste the files here. It is possible that you need to also paste them into the region-specific folders: I had to paste them into en-US, which is not my region.
  4. Open the Group Policy Editor: Hit the Windows key and type GPO, Enter
  5. Inside the Editor, navigate to Computer Configuration > Administrative Templates > OneDrive. You should see this window: screenshot of the group policy editor for one drive For me it is already enabled; by default it is set to Not configured.
  6. Head over to the highlighted line, "Exclude specific kinds of files from being uploaded", right-click it and select Edit.
  7. The Edit Window looks like this: screenshot of the settings for excluding file types
  8. Tick the Enable radio button and then click on Show.
  9. A new window opens. In there, you can add every file ending (plus the period symbol: i.e. write .exe, not exe. Here is how it looks for me having added a file ending: screenshot of adding a new file ending to be ignored
  10. End the OneDrive process, and delete any file with that new ending. This step might be optional of you are willing to wait for OneDrive to catch up on the new rule. It will not immediately block the files with the ignored ending.

The result should look like this in your OneDrive folder:

enter image description here

And when I open the OneDrive Dialog via right-clicking the Taskbar icon, I see this hint: screenshot of one drive saying a file type is excluded

What is really nice about this (albeit cumbersome) solution, is that I don't need any administrative rights for OneDrive itself. My company handles all of that so I don't have access to those settings.

Troubleshooting that I had come across:

  1. Only the .admx file was copied, but .adml was missing -> both need to be copied
  2. The .admx/.adml files were in the general Policy Folder, but not the region-folder such as en-US or en-GB. This can lead to an error when starting the Group Policy Editor saying that the file specified cannot be found.
  3. Group Policy Editor is not available -> Must be on Windows Pro!

From the website I linked above, there is also another option that did not apply to me. From the website:

If you are using a MDM solution (like Intune) for your BYOD devices or Azure AD Joined only devices you can push the following registry:


Key: EnableODIgnoreListFromGPO

Type: REG_SZ Value

Name: the file type you want to exclude

Value: the file type you want to exclude

I checked my registry and I didn't have this entry.

  • This no longer works and has been broken basically since day one. Ms corporate support confirmed there is no ETA for a fix.
    – rollsch
    Commented Jul 23, 2021 at 0:03
  • The screenshots are from my machine, it definitely works for the .RHistory ending for me. I found it to be fickle with some file endings, too (anything related to LaTeX) and I agree it's really hacky, but I can't confirm that it doesn't work at all.
    – LonLon
    Commented Aug 23, 2021 at 10:51
  • Can you confirm it works as of today?
    – rollsch
    Commented Aug 24, 2021 at 11:05
  • 1
    @rollsch it still works for me as of today. Microsoft added this feature now, I updated the answer with the link to their guide.
    – LonLon
    Commented May 17, 2022 at 11:19
  • 1
    Now they splitted it from EnableODIgnoreListFromGPO into File EnableODIgnoreFileListFromGPO and Folder EnableODIgnoreFolderListFromGPO
    – Tomblarom
    Commented Feb 13 at 16:11

Not as far as I know, but it's currently "in the plans" according to Microsoft. It's tracked on OneDrive's Feedback Portal page here.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .