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?– DrZooCommented 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.– leeand00Commented 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/…– Ciprian TomoiagăCommented Jan 6, 2023 at 14:37
2 Answers
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:
- OneDrive version 20.201 and higher
- Windows Pro/Education or any Windows that has a Group Policy Editor
- Administrative Rights on the Windows Machine as you need access to C:/Windows
- This must also be the OneDrive Client. You can still upload the blocked file types via the web interface(!)
Steps:
- Go to
%localappdata%Microsoft/OneDrive/<VersionNumber>/adm
- In there, copy the
OneDrive.adml
andOneDrive.admx
files. - 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 intoen-US
, which is not my region. - Open the Group Policy Editor: Hit the Windows key and type
GPO
, Enter - Inside the Editor, navigate to
Computer Configuration > Administrative Templates > OneDrive
. You should see this window:For me it is already enabled; by default it is set to
Not configured
. - Head over to the highlighted line, "Exclude specific kinds of files from being uploaded", right-click it and select
Edit
. - The
Edit
Window looks like this: - Tick the
Enable
radio button and then click onShow
. - A new window opens. In there, you can add every file ending (plus the period symbol: i.e. write
.exe
, notexe
. Here is how it looks for me having added a file ending: - 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:
And when I open the OneDrive Dialog via right-clicking the Taskbar icon, I see this hint:
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:
- Only the
.admx
file was copied, but.adml was missing
-> both need to be copied - The .admx/.adml files were in the general Policy Folder, but not the region-folder such as
en-US
oren-GB
. This can lead to an error when starting the Group Policy Editor saying that the file specified cannot be found. - 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:
HKLM\SOFTWARE\Policies\Microsoft\OneDrive\
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.– rollschCommented 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.– LonLonCommented Aug 23, 2021 at 10:51
-
-
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.– LonLonCommented May 17, 2022 at 11:19
-
1Now they splitted it from
EnableODIgnoreListFromGPO
into FileEnableODIgnoreFileListFromGPO
and FolderEnableODIgnoreFolderListFromGPO
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.
-
see this github issue which 1) is the OP's question and 2) explains why the link in this answer doesn't work anymore.– ecstremaCommented Nov 16, 2021 at 2:05
-
1New URL to the user comment is here (because microsoft uses their own portal now, but imported some requests): feedbackportal.microsoft.com/feedback/idea/… and leading to this explanation: docs.microsoft.com/en-us/onedrive/…) Commented Dec 20, 2021 at 0:33