Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Stop Windows From Deleting Files: 7 Fixes

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Windows can delete or remove files for several reasons: Storage Sense, OneDrive's free-up-space feature, antivirus false positives, or a corrupted user profile. The fix depends on which one is doing the deleting, but you can usually stop it by turning off Storage Sense, pausing OneDrive sync, or adding an antivirus exclusion. Below are the exact steps to identify the culprit and stop the deletions.

What You'll Need

  • Administrator access to the Windows PC (to change system settings).
  • If files are in OneDrive, sign in to the Microsoft account linked to that folder.
  • If you suspect antivirus, know which antivirus you use (Windows Defender, third-party, etc.).

Step-by-Step

1. Turn Off Storage Sense

  1. Open Settings (press Windows + I).
  2. Go to System > Storage.
  3. Click Storage Sense (or “Storage management” on some versions).
  4. Toggle Storage Sense to Off.
  5. Also click Cleanup recommendations and check if any automatic cleanup is scheduled. Disable any “Automatic user content cleanup” if present.

Note: Labels may differ slightly by Windows version (10 vs. 11) and region.

2. Stop OneDrive From Freeing Up Space

  1. Right-click the OneDrive cloud icon in the system tray (near the clock).
  2. Select Settings (or “Help & Settings” > “Settings”).
  3. Go to the Sync and backup tab.
  4. Under “Advanced settings”, click Free up space.
  5. Make sure the option “Make files online-only when you run out of space” is unchecked.
  6. Also, if you see “Files On-Demand”, ensure it is set to “Keep files on this device” for the folders you care about.

3. Add Antivirus Exclusions (If False Positives Are Suspected)

  1. Open Windows Security (search for it in the Start menu).
  2. Go to Virus & threat protection.
  3. Under “Virus & threat protection settings”, click Manage settings.
  4. Scroll down to Exclusions and click Add or remove exclusions.
  5. Add the folder where your files are being deleted. Choose Folder, browse to the location, and confirm.
  6. If you use a third-party antivirus, open its settings and look for “exclusions”, “whitelist”, or “allowed files”. Add the same folder there.

4. Check Recycle Bin Settings

  1. Right-click the Recycle Bin on your desktop and select Properties.
  2. Make sure the option “Don't move files to the Recycle Bin. Remove files immediately when deleted” is not selected.
  3. Choose “Custom size” and set a reasonable maximum size (e.g., 1024 MB) so files are not auto-purged.

5. Disable “Delete Files After X Days” in OneDrive

  1. In OneDrive Settings (same as step 2), go to the Sync and backup tab.
  2. Click Advanced settings.
  3. Under “Files On-Demand”, look for “Delete files after X days” and set it to Never if available.

6. Check for Corrupted User Profile or Folder Permissions

  1. If files disappear from a specific folder, right-click that folder and select Properties.
  2. Go to the Security tab and click Advanced.
  3. Check that your user account has Full control or at least Modify permission.
  4. If not, click Change permissions and add your account with Full control.
  5. If the issue persists, create a new user account and see if files stay. If they do, your old profile is corrupted.

7. Disable “Free Up Space” in Windows 10/11

  1. Open Settings > System > Storage.
  2. Click Cleanup recommendations.
  3. Under “Files to delete”, look for “Free up space now” or “Storage Sense” and disable any automatic scheduling.

Common Mistakes

  • Turning off Storage Sense but leaving “Cleanup recommendations” on. Some versions have a separate automatic cleanup toggle.
  • Only adding an exclusion for a file, not the folder. If the file is re-created, it may be flagged again.
  • Assuming OneDrive is not involved. If your files are in a OneDrive folder, the “free up space” feature can delete local copies without warning.
  • Not checking the Recycle Bin. Files may not be permanently deleted, but the Recycle Bin may auto-purge after a set number of days.

Tips

  • Keep important files in a folder that is not synced to OneDrive, or at least keep a copy on an external drive.
  • Regularly back up critical data using File History or a cloud backup service.
  • If you use third-party antivirus, check its quarantine section first—files may be there, not deleted.
  • Use the Windows Event Viewer (Event Viewer > Windows Logs > Application) to see if any service logged a deletion event.

Troubleshooting

If files are still disappearing after following the steps above:

  1. Restart your PC. Some settings require a reboot.
  2. Update Windows. Go to Settings > Windows Update and install all pending updates.
  3. Run a full antivirus scan. A malware infection can delete files. Use Windows Defender offline scan or your third-party tool.
  4. Check if the issue happens in Safe Mode. Boot into Safe Mode (Settings > System > Recovery > Advanced startup, then choose Safe Mode). If files stay, a third-party app is interfering.
  5. Restore from backup. If you have a backup, restore the missing files. If not, try File History (Control Panel > File History) or previous versions (right-click folder > Properties > Previous Versions).

Frequently Asked Questions

Why did Windows delete my files without asking?

The most common causes are Storage Sense (which cleans up temporary files and recycle bin contents) or OneDrive's “free up space” feature that removes local copies of cloud-only files.

Can I recover files that were already deleted?

Yes, if they are in the Recycle Bin, right-click and choose Restore. If not, try File History or a data recovery tool—but stop using the drive immediately to avoid overwriting.

Does Storage Sense delete files in my Documents folder?

Storage Sense typically only deletes temporary files, recycle bin contents, and files in the Downloads folder older than a set time. It does not delete files in Documents unless you have configured it to do so.

How do I know if OneDrive is deleting my files?

Check if the files are in a OneDrive folder (usually under C:\Users\YourName\OneDrive). If they are, look at the OneDrive icon in the system tray—if it shows a cloud icon with a checkmark, the file is online-only and the local copy may have been removed.

Is it safe to turn off Storage Sense?

Yes, it is safe. You will need to manually clean up temporary files, but your personal files will not be automatically deleted.

What if my antivirus is deleting files?

Add an exclusion for the folder in your antivirus settings. If you are unsure, temporarily disable the antivirus (do not browse the web) and see if files stay. If they do, re-enable and add the exclusion.