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.
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:
- Open the Security app (shield icon).
- Go to Cleanup (or Cleanup in older versions).
- Press three points (โฎ) in the upper right corner and select Cleaning Settings.
- Slip on the Exclusion clause (or Add to the Exceptions).
- 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:
- Open the Files app.
- Find the desired file or folder and make a long press to highlight.
- Tap it on three points (โฎ) In the upper right corner, select Protect (or Add to Protected).
- 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.
| folder | Way | Features |
|---|---|---|
| MIUI | /storage/emulated/0/MIUI | It contains shell system data. It's not recommended to store large files here. |
| Android | /storage/emulated/0/Android | Except for that, the data subfolder is cleaned. Only media and obb are secure. |
| Pictures/Screenshots | /storage/emulated/0/Pictures/Screenshots | Screenshots are protected from cleaning, but only if taken through system tools. |
| DCIM/Camera | /storage/emulated/0/DCIM/Camera | Photos and videos taken on camera are not deleted (except for duplicates). |
How to transfer files:
- Open the files and find the target file.
- Select it with a long press and select Move it.
- Specify one of the protected folders (for example, DCIM/Camera).
- 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:
- Create a folder with a dot at the beginning of the name (for example,.secret_files) root-memory.
- Move the important files there.
- 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?
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:
- Go to Settings. โ Memory.
- Tap it on three points (โฎ) and select Memory Settings.
- 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.