Recently Windows 10 went through the fall creator’s update without my permission, I found out that I can no longer access my onedrive folder while I’m booted into linux. To clarify, the folder does not shows up in gui but does shows up red when using ls command in the directory. Through many frustrations and this post here, I realize it’s something the update did that created reparse points on everything in my onedrive folder. And from the same place I found the command below to delete reparse points, one at a time. It wasn’t enough to solve the problem since I have more than 100 folders in my onedrive.
Since it only happened to my folders/files in onedrive, first thing I tried is move everything out of it to a separate location and create symlink back in onedrive so I can keep them updated in the cloud. Unfortunately, that did not fix the problem, those reparse point lives and still denying me access to my own files. Frustrated, I started using fsutil command to delete the reparse points one by one. Soon I realized it wasn’t an acceptable solution since it’ll take hours. So frustrated and angry at Microsoft, I created a python script to apply the command above to everything in the directory.
First through I need to get a list of all the files/directory/subdirectory. I found this really neat one line command in stackoverflow post here.
Do note that you need to replace ‘./’ to whatever path string you desires.
However, this one line command only gather a list of files, without directory or subdirectories.
With help from this post, it is this command here that really does the job of gathering everything.
Now that I have a list of all the files, directories and subdirectories, I can use a for loop to run the fsutil command on each and every one of them. Since my computer is fast enough and I’m lazy, I’m not going to shy away from launching too many command prompt and included a line to start command prompt so that I can verify it works.
Got replies below pointed out my mistake of including the start line at the end to run the command with cmd. The idea behind it was to running the command in a terminal so that I can verify that it works, but it was clearly unwise to include it in a for loop which would summons a cmd for every single file/folder you have, potentially crashing the computer. Taking that out and run os.popen(args) instead would be cleaner. Here’s the modified for loop.
Another very helpful reply! I should’ve mentioned that the cause to the reparse points are the “Files on Demand” feature in OneDrive. Turning it off should no longer create reparse points on your new files and folder. Unfortunately, Windows does not delete the already exist reparse points. According to empty_other’s reply below, launch powershell, navigate to OneDrive folder and run the command below should fix the problem. Much more cleaner than my python solution!
*Note that I have not tested this since I no longer have the issue. Do comment below if it doesn’t work.
Error: The tag present in the reparse point buffer is invalid.
Was able to fix the error and run the powershell command without error.
This was verified by Samer who first encountered this issue.
You’re right there’s no need for the start line, I did not think of that while I was writing this up. Thanks for letting me know!
Had the same issue recently, with the result that I couldn’t delete my OneDrive folders. Seems Windows can’t delete reparse point folders.
Does the same thing as your Python script, I believe. But doesn’t spawn all those cmds.
Yeap forgot to mention in this post, discovered “Files on Demand” is the cause and I’ve had it disabled ever since. Brilliant! I’ll add your solution to the post as well, hope I was smart enough to figure that out when I had the issue. Spawning the cmds weren’t necessary and it was a method for me to verify that it works while I was testing the script, I left it in while I execute it on all the files/folders, which was certainly unwise.
Sorry no idea about this, I am not familiar with the powershell commands. Did you try what empty_other suggested and see which paths were giving the error?
I had tried the powershell command which still returned the error.
Hopefully this will help anyone else having this issue.
chkdsk /r/f I was able to delete the folder without any error.
Thanks Stuart for providing the solution! I’ll add it to the post as a potential solution.
Script didn’t work for me either, but chkdsk /r/f did the job – man that took a lot of digging! – Thank you very much for sharing that.
Did not give me any error and did the job nicely.