Many antivirus software programs automatically delete suspicious files during security scans. Although these antivirus tools let you restore deleted files, they’ll most likely delete the file again during subsequent scans. To prevent a recurrence, it’s best to configure your antivirus to exempt important files when scanning for viruses and malware.

We’ll show you how to prevent your antivirus from deleting files automatically without your approval. This tutorial will cover steps for Windows Defender and popular third-party antivirus software—Avast, AVG, BitDefender, etc.

Table of Contents

    Before you proceed, confirm that the file(s) is safe and won’t damage your PC and data before exempting it from antivirus scans. Excluding a (harmful) file from being deleted may increase your PC’s vulnerability to malware attacks and other threats.

    Note: The troubleshooting steps in this tutorial are applicable to Windows 10, Windows 11, and Mac or (macOS) devices.

    Prevent Avast Antivirus from Deleting Files

    Follow the steps below to stop Avast from deleting a file, folder, or app when scanning your PC for threats.

    1. Launch the Avast, select the hamburger menu icon in the top-left corner, and select Settings.
    1. In the General section, select Exceptions on the sidebar and select the Add Exception button.
    1. Select Browse.
    1. Select the checkbox next to the item (file, folder, app, etc.) you want to exempt from Avast scans and select OK.
    1. Select the Add Exception button to proceed.

    That’ll prevent Avast from deleting the selected file(s) during all security scans. Avast also lets you exclude items from a specific type of scan. See the next step for detailed instruction.

    1. Head to Avast’s Exceptions menu (see step #3) and select Add Advanced Exceptions.
    1. Head to the File/Folder tab and select Browse to choose the files/folder you want to exclude. Afterward, check the box next to the scan types and select Add Exception.

    After this, Avast will skip the file(s) during the selected security scans. Avast will also list all exempted items in the “File or Folder” section. To delete an exclusion, hover your cursor on the item and select the Bin icon. Otherwise, select the Pen icon to edit the exclusion.

    Prevent AVG from Deleting Files

    AVG is also an Avast-owned security software. The process for preventing AVG from automatically deleting files is similar to Avast’s.

    1. Launch AVG, select the hamburger menu icon in the top-right corner, and select Settings.
    1. Head to the General tab, select Exceptions on the sidebar, and select Add Exception.
    1. Select Browse.
    1. Select the checkbox next to the file(s) or folder(s) you want to exclude from malware scans, and select OK.
    1. Select Add Exception to proceed.

    To remove a file from the exception list, hover your cursor on the item in the “File or Folder” section, and select the Bin icon.

    Prevent BitDefender from Deleting Files

    If BitDefender is the default antivirus solution on your computer, here’s how to prevent the app from deleting a file when scanning for threats.

    1. Open BitDefender, head to the Protection tab (on the sidebar), and select Settings in the “Online Threat Prevention” section.
    1. Select Manage exceptions in the “Exceptions” row.
    1. Select Add an Exception on the next page.
    1. Select the folder icon with a magnifying glass in the search box.
    1. Select the file or folder you want to prevent the antivirus from deleting and select OK.
    1. In the “Protection Feature” section, toggle-on Antivirus. Afterward, select the checkbox next to the scan types. BitDefender won’t scan the exempted items when you run the selected scans. Select Save to proceed.

    Head to the “All exceptions” tab to preview the exempted files. Select the Bin icon to delete a file or select the Pen icon to modify the exception options.

    Prevent Windows Defender from Deleting Files

    Windows Defender also lets you exclude items—files, file types, processes, folders, etc.—from security checks. In this section, we’ll show you how to configure the Windows Security settings so that your PC won’t automatically delete files it suspects to be malicious.

    1. On a Windows 11 computer, go to Settings > Privacy & security > Windows Security.

    For Windows 10, head to Settings > Update & Security and select Windows Security.

    1. Select Virus & threat protection in the “Protection areas” section. That’ll launch the Windows Security app.
    1. Scroll to the “Virus & threat protection settings” section and select Manage settings to open Windows Defender settings menu.
    1. Scroll to the “Exclusions” section and select Add or remove exclusions.
    1. Select the Add an exclusion button.
    1. Select File from the options, since you’re trying to prevent Windows Security (or Windows Defender) from deleting a specific file type.
    1. Navigate to the folder or destination where the file is located on your computer and select the file you want to stop Windows Defender or Windows Security from deleting. Select Open to continue.
    1. To stop Windows Defender from deleting a particular file type or extension, select File type in the drop-down menu and enter the extension in the box.

    Note: You can enter the file extension with or without the preceding period (.). Say you want to stop Windows Security from flagging or deleting DLL files, you can enter the file type/extension as dll or .dll. For executable files (or exe files), type exe or .exe into the dialog box.

    1. Select Add to include the file type in Windows Defender’s exclusion list.
    1. To exclude a specific process, return to the “Exclusions” menu (see step #4), select the Add an exclusion button, and select Process.
    1. Enter the process name and select Add.

    Quick Tip: Launch Task Manager and go to the Details tab to view a list of all processes running on your Windows computer. Check the “Name” column for the name of each process.

    When you exclude a process in the Windows Security settings, files opened by that particular process will also be excluded during real-time protection. However, the process’ files won’t be exempted during on-demand and scheduled scans.

    You’ll find excluded files, folders, file types, processes, and other items in the Windows Security Exclusions page—right below the “Add an exclusion” button.

    To remove an item from the list, select the file/file type/process, and select Remove.

    You should disable Windows Defender and use third-party antivirus programs if Windows Security keeps deleting your files.

    One More Thing: Disable Storage Sense in Windows

    Storage Sense isn’t an antivirus. It’s a feature in Windows that frees up disk space by automatically deleting files you haven’t used in the last 30 days. If your PC often deletes files, and your antivirus program isn’t the culprit, consider disabling Storage Sense.

    Note: Storage Sense doesn’t delete items in the Downloads folder or items saved by cloud storage services like OneDrive.

    Go to Settings > System > Storage and toggle off Storage Sense in the “Storage management” section.

    There are hundreds of antivirus software out there. If you don’t use any of the apps mentioned above, contact the developer or check the developer’s website to learn how to prevent that antivirus from deleting files when scanning for malware.

    Losing important files can be terrible. If your antivirus deleted a file you haven’t added to its exception list, you can always get back the file using data recovery software.