In the Files app of stock Android 10 (Pixel 2 XL), there is a "Recent" category. For privacy reasons, I wanted to delete a file in this category. As far as I have searched for this file by filename, and it doesn't seem to exist on my system, but still appears in the list. I've tried clearing the cache/storage for the "Files" app, but it still remains. How can I remove this item from the recent list, clear the entire list, or get the file's folder location so I can delete the real file?
Files app (
com.android.documentsui) in stock Android (not that modified by OEMs or custom ROM developers) shows recently modified (within 45 days) image and video files (64 each at maximum) from whole shared external storage (
/sdcard and external SD card) under Recent category. A multi-purpose list of all files is built and managed by Media Provider. See how files are categorized based on their extensions. Apps' private
files directories aren't scanned by
media directories are (see where Android apps store data). Similarly directories starting with a dot (
.) or those having a
.nomedia file and their sub-directories aren't scanned.
So any existing files which are not excluded from scanning cannot be removed from Recent category. You may possibly disable the app to hide it from launcher. But the indexed files appear in any app which relies on Media Provider, including MTP. However if a non-existent file is wrongly indexed in database (
/data/data/com.android.providers.media/databases/external.db) you can trigger a media scan or delete data of Media Storage app. See this answer for more details.