OneDrive Warning: Deleted Files Are Deleted Everywhere

Is there a way to avoid windows displaying this warning when deleting a file?

eac77a57-4ea5-4278-a8ae-8fe15a3604de

This happens when a user has their Documents folder synced with OneDrive which is frequently the case.

In my case, I save the user data to a temp file next to their existing save in Documents, delete the old save and rename the temp file to be their save. The user gets warned when deleting their save.

I don’t want to overwrite the existing save as a crash would render it corrupt.

Perhaps write the temp file to SpecialFolder.Temporary instead?

There’s a checkbox on the screenshot “Don’t show this reminder again” :slight_smile:
Why overcomplicate simple solutions?

And how would you stop it showing the first time? If the answer is obvious, you might have missed the question :slight_smile:

You could try checking:

HKEY_CURRENT_USER\Software\Microsoft\OneDrive

FirstDeleteDialogsShown DWORD

0 = Enable
1 = Disable

and toggle it while you do the “dirty” then put it back again (not tested).

^ This, and if you want to keep track of such temporary files and even recover them after a crash, maintain them in some fixed proper place for your app like SpecialFolder.ApplicationData.child(“MyAppFolderData”).Child(“MyTemporaryFile_2379457234.ess”)

That is not a solution, you should NOT change other programs options risking the user to data loss with ALL of their files just to avoid a single delete action from your program.

2 Likes

you could copy the original file to temp
and then overwrite the document folder with your new data.
if this fail copy back the temp file.
if all run well delete the temp file.

What will you do if the application (or the computer) crash in the process… ?

the topic is about this delete warning.

I understand that, thank you.

Your advice:

you could copy the original file to temp

Unfortunately, a crash happens here…

and then overwrite the document folder with your new data.

if a error occur the original will still exists.
if you use try catch nothing happens.
assumed error handling is correct and it control the app flow.

1 Like

Just avoid those things as copy there / delete / copy back…, just create and use the temporary files in the proper temporary places, write or overwrite the final file where it belongs when finished, delete the temporary after (as they are only local, they won’t raise warnings about cloud synchronizing).

The actual copy is made by the OS, if the app crashes before the instruction, the file is not copied, since te copy is syncronous, the app cant really crash there, if crahses after, the file is already copied, so… what are you talking about?