How to add files to the cleaning exceptions on Xiaomi: save important data

Xiaomiโ€™s MIUI-based smartphones are actively optimizing memory by automatically removing โ€œunnecessaryโ€ files โ€” app cache, temporary data, and even downloads. But what if the system accidentally erases important documents, archives, or media files? In this article, weโ€™ll discuss how to add files and folders to the cleanup exceptions so that they remain intact during automatic cleaning.

The problem is especially relevant for users of devices with limited memory (for example, Redmi Note 10 or POCO X3 Pro 64 GB), where every megabyte is in the account. Even if you use Settings โ†’ Memory โ†’ Cleanup, the system can delete files that you will need. Fortunately, MIUI provides tools to protect data โ€” you just need to know where to look for them.

Itโ€™s important to understand that exceptions only work for built-in cleaning tools (like โ€œDumpster Cleanupโ€ or โ€œDeep Cleanupโ€). If you use third-party apps like CCleaner or Files by Google, youโ€™ll have to duplicate the settings there, too. Also, keep in mind that some system files (like Google Play Services cache) canโ€™t be added to exceptions โ€” cleaning them is critical for a stable smartphone.

Why does Xiaomi delete files without asking?

Automatic cleaning in MIUI is based on algorithms that analyze:

  • ๐Ÿ“… Last Use Date โ€“ Files that have not been accessed for more than 30 days are considered โ€œunnecessaryยป.
  • ๐Ÿ—‘๏ธ File type โ€“ temporary files (.tmp,.log), application cache and media duplicates are deleted first.
  • ๐Ÿ“‚ Location - Download folders, DCIM/.thumbnails and Android/data They are more aggressive than others.
  • ๐Ÿ“ฑ Memory status โ€“ if less than 10% is free, the system starts deleting files without even notifying you.

Unfortunately, the algorithm is not perfect. For example, it can delete:

  • ๐Ÿ“„ Backup archives (.zip,.rar) if you havenโ€™t opened them in a while.
  • ๐ŸŽต Music or podcasts downloaded for offline listening (for example, via Spotify or Yandex Music).
  • ๐Ÿ“Š Application databases (for example, messaging histories on Telegram or WhatsApp if stored in internal memory).

To avoid loss, you just need to add critical files to exceptions, but first, let's figure out what tools MIUI has to do with this.

๐Ÿ“Š How often does your Xiaomi delete files?
Never noticed.
Once a few months
It's always annoying!
I don't know, I don't.

Method 1: Exceptions to Waste Cleanup (for MIUI 12โ€“14)

The most reliable method is to use the built-in Cleanup tool, which is available on all modern Xiaomi devices, including Redmi, POCO and Black Shark. The instructions are relevant for firmware based on Android 10-14.

How to add files to exceptions:

  1. Open the Security app (shield icon).
  2. Go to Cleanup (or Cleanup in older versions).
  3. Press three points (โ‹ฎ) in the upper right corner and select Cleaning Settings.
  4. Slip on the Exclusion clause (or Add to the Exceptions).
  5. Choose Add Files or Add folders and specify the desired items through the file manager.

Please note:

  • ๐Ÿ” You can only add files from internal memory. SD-The card does not fall under the exceptions.
  • ๐Ÿ“ Exceptions work recursively โ€“ if you add a folder, all of its subfolders and files will also be protected.
  • ๐Ÿ”„ After updating MIUI The exception list may be reset.

Check the version of MIUI in Settings โ†’ About the phone

Make sure that the files are not on SD-map

Backup of important data

Close all applications that work with these files-->

If there is no Exclusion on the menu, then your version of MIUI does not support this function, in which case use the alternative methods described below.

Method 2: File Manager (Protection through Files)

Xiaomiโ€™s standard File Manager app has a hidden file protection feature that doesnโ€™t work on all devices, but itโ€™s worth a try.

Instructions:

  1. Open the Files app.
  2. Find the desired file or folder and make a long press to highlight.
  3. Tap it on three points (โ‹ฎ) In the upper right corner, select Protect (or Add to Protected).
  4. Confirm the action. The file will be marked with a special icon. ๐Ÿ”’.

What protection does:

  • ๐Ÿ›ก๏ธ The file will not be deleted when manually cleaned through the Files โ†’ Cleanup.
  • โŒ Does not protect against automatic cleaning by the system (for example, if there is a lack of memory).
  • ๐Ÿ”“ To remove protection, repeat the actions and select Remove protection.

This is a convenient way to temporarily protect files you plan to use soon, such as if you downloaded a large archive and fear the system will delete it before you can unpack it.

๐Ÿ’ก

If the Protect feature is missing, update the Files app via Google Play, and some firmware only shows up after the update.

Method 3: Transfer files to MIUI secure folders

MIUI has several system folders that are never automatically cleared, and if you move important files there, they're safe.

folderWayFeatures
MIUI/storage/emulated/0/MIUIIt contains shell system data. It's not recommended to store large files here.
Android/storage/emulated/0/AndroidExcept for that, the data subfolder is cleaned. Only media and obb are secure.
Pictures/Screenshots/storage/emulated/0/Pictures/ScreenshotsScreenshots are protected from cleaning, but only if taken through system tools.
DCIM/Camera/storage/emulated/0/DCIM/CameraPhotos and videos taken on camera are not deleted (except for duplicates).

How to transfer files:

  1. Open the files and find the target file.
  2. Select it with a long press and select Move it.
  3. Specify one of the protected folders (for example, DCIM/Camera).
  4. Confirm the move.

โš ๏ธ Note: Do not move files with extensions that do not fit their purpose into these folders, for example, if you put the.zip archive in the file. DCIM/Camera, It may not be visible in the gallery and will be difficult to access.

This is a good way to store critical data for long periods of time, for example, you can create an Important folder in Pictures and back up your files.

Method 4: Using Hidden Folders (for Advanced)

If you're willing to dig a little bit into the system, you can create a hidden folder that MIUI won't touch, which requires access to the file system through ADB or a root file manager (like Solid Explorer or FX File Explorer).

Instructions:

  1. Create a folder with a dot at the beginning of the name (for example,.secret_files) root-memory.
  2. Move the important files there.
  3. To prevent the folder from appearing in the standard manager, enable the display of hidden files in the Files settings.

Why it works:

  • ๐Ÿค– Folders with a point (.) at the beginning of the name are considered system-based and are ignored by most cleaning tools.
  • ๐Ÿ” They are not visible in the standard Files interface unless you enable the appropriate setting.
  • โš ๏ธ Risk: When you reset your settings or update your firmware, such folders may be deleted.

For reliability, you can additionally add a folder to exceptions through Security โ†’ Cleanup (see Method 1).

How to create a hidden folder without root rights?
If you donโ€™t have root, use it. ADB-Command: Adb shell mkdir /sdcard/.my_hidden_folder Then transfer the files via the command: adb push local path /sdcard/.my_hidden_folder/ The folder will be hidden from standard cleaning tools.

Method 5: Turning off automatic cleaning (radical method)

If youโ€™re annoyed by aggressive cleaning, you can turn off automatic memory optimization completely, which is not recommended for low-storage devices (less than 64GB), but on smartphones with 128GB or more.

How to turn it off:

  1. Go to Settings. โ†’ Memory.
  2. Tap it on three points (โ‹ฎ) and select Memory Settings.
  3. Turn off the options: ๐Ÿ”„ Auto-cleaning of garbage ๐Ÿ“‰ Optimization with a lack of memory ๐Ÿ—‘๏ธ Delete unused files

โš ๏ธ Warning: Once you turn off these functions, you'll have to manually monitor the vacant space if the memory is 90%+, The system will start to slow down, and some applications will refuse to update.

An alternative is to limit the aggressiveness of cleaning:

  • Settings โ†’ Memory โ†’ Memory settings set the cleaning threshold to 500 MB of free space (instead of the standard 1-2 GB).
  • In Security โ†’ Clean โ†’ Settings turn off the Deep Clean option โ€“ it deletes more files than normal.

These settings will help reduce false positives, but they don't guarantee 100% protection. For reliability, combine this method with adding files to exceptions.

๐Ÿ’ก

Turning off automatic cleaning increases the risk of memory filling, but gives you complete control over files, and only use this method if you are ready to manage your storage yourself.

What to do if the files have already been deleted?

If the system does delete important data, don't panic. There are several ways to recover it:

Method 1: Checking the basket

  • Open the Files app.
  • Go to the basket section (the bin icon).
  • Find the deleted file and click Restore.

The storage period in the basket is 15 days, and then the files are deleted irrevocably.

Method 2: Recovery through backup

  • If you used Mi Cloud or Google Drive for backup, check the archives in these services.
  • For media files (photos/video) look in Google Photos โ€“ there can be a copy saved.

Method 3: Recovery programs

If the files are not in the Recycle Bin and there is no backup, try utilities like DiskDigger, Recuva (for Windows) or EaseUS MobiSaver.

  • ๐Ÿ›‘ Do not write new files to your device before recovery โ€“ they can overwrite deleted data.
  • ๐Ÿ”Œ Connect your smartphone to your PC in file transfer mode (MTP).
  • โณ Recovery can take several hours.

โš ๏ธ Note: Recovery software does not guarantee 100% results. The longer it takes to delete the file, the lower the chances of returning the entire file.

To avoid such situations in the future, set up an automatic backup in Mi Cloud or Google Drive. Even if the system deletes the original, you will still have a copy in the cloud.

FAQ: Frequent questions about the purification exceptions on Xiaomi

Can I add files to the exceptions? SD-map?
No, built-in tools. MIUI They only work with internal memory, to protect files on the computer. SD-Use: Hidden folders (with a dot at the beginning of the name) Third-party file managers with lock function (for example, FX File Explorer Encryption of archives (e.g. through 7-Zip password-wise).
Why did the exceptions fall off after the MIUI update?
For major updates (e.g., from MIUI 13 to MIUI 14), some settings are reset. To avoid losses: Before updating, take a screenshot of the exception list. Save important files to the cloud or PC. After the update, check the settings in Security โ†’ Cleanup โ†’ Exceptions.
How to protect application files (e.g., game cache)?
Application cache (/Android/data and /Android/obb) Exceptions cannot be added by standard means: ๐ŸŽฎ For games: use the function Transfer to SD-card (if supported). ๐Ÿ”„ Regularly backup your Android folder through ADB: adb pull /sdcard/Android/ ๐Ÿ›ก๏ธ Install AppOps (root required) and disable cache cleaning for specific games.
Will file protection work after resetting to factory settings?
No, hard reset resets all cleaning settings are reset and files in the internal memory are deleted. SD-Backup your apps in Mi Cloud or Google Drive. Use Titanium Backup to save apps and their data.
Can I protect files from being cleaned without using them? MIUI-tool?
Yeah, there are a few workarounds: ๐Ÿ” Encryption: Archive password files (for example, through 7-Zip or RAR). Encrypted archives ignored by cleaning tools. ๐Ÿ“Ž Note attachment: Put files in a note in Mi Notes or Google Keep โ€“ they are stored in the cloud. ๐Ÿ“ง Send your emails as an attachment, so they'll be available anytime.