1. Home
  2. Mobile
  3. How to prevent a directory from being scanned by android gallery

How To Prevent A Directory From Being Scanned By Android Gallery

The quick and smooth loading of your picture Gallery lasts only while your Android device is new or freshly wiped. After youโ€™ve filled your device with apps, music and picture albums to your heartโ€™s content, it begins to take more than its due share of time to scan your SD card for images, loading everything from pictures taken from the camera to wallpapers, album art and extracted icon packs. Generally, users donโ€™t want album art and icons cluttering the gallery and leeching its loading speed. Some might even wish to hide a particular directory or picture album from the gallery. If either of the aforementioned holds true for you, join us after the jump for the solution.

While most gallery apps, such as the Sense and MIUI native galleries, might allow you to hide directories from the interface, they usually donโ€™t stop loading such directories on launch. Also, this method doesnโ€™t ensure your privacy as hidden directories can be revealed easily from within the app.

Prevent-Media-Scanning-On-Directories

To prevent your Gallery app from scanning these directories at launch, you must employ one of the following methods. If you try one of the following shortly after launching your Gallery, you will have to refresh (or force-close and reopen) it to view the changes made.

Method 1 – Creating A .nomedia File

.nomediaUsing any file explorer/manager application (such as Astro File Manager or File Expert), navigate to the directory that you want hidden and create an empty file titled โ€œ.nomediaโ€.

One way to do so is to:

  • Copy an existing text (.txt) or even an image (.jpg/.jpg) file to said directory,
  • Open it in a text editor (hold down on the file and select the appropriate option from the context menu that appears),
  • Delete its contents (hold down on the text, Select all and Delete), save changes and exit,
  • Rename it to โ€œ.nomediaโ€ (hold down on the file again and select Rename from its context menu).

This method disables media scanning on the chosen directory, causing the Gallery to skip the directory altogether at launch.

Method 2 – Adding A Dot Prefix

dot-prefixUsing any file explorer/manager application, locate the directory that you want hidden and add a โ€œ.โ€ before its name (โ€œ.directorynameโ€).

If youโ€™re using Astro, youโ€™ll have to hold down on the directory and select Edit > Rename from its context menu to do so.

This method converts the chosen folder into a hidden directory. File explorers like Super Manager, eFile and MIUIโ€™s native file explorer do not have the option to view hidden folders enabled by default. So if your altered directory disappears from the interface, do not be alarmed. It is still there.

You may enable said option later to revert the changes you made. Alternatively, you can always connect your device to your computer and mount the SD card to do the same. The dot prefix hides the directory on Linux-based systems only. Youโ€™ll be able to to view them if, say, your computer is running Windows.

Method 3 – Using Super Manager Or .nomedia Manager

If youโ€™re using Super Manager, you can disable media scanning for multiple directories by selecting the check box in front of each and tapping the toggle media scanning option below. The following screenshot (left) should clear things up.

Super-Manager-media-scanning-disabled.nomedia-Manager

If youโ€™re looking for a quicker, more user-friendly solution, you might want to try StudioKUMA .nomedia Manager.

Both apps essentially provide you with one to two-tap alternative to creating a .nomedia file within the desired directories (Method 1). If you think youโ€™ll need to enable and disable media scanning on folders repeatedly, it is best that you install one of the mentioned apps, otherwise, the manual method should suffice.

Super Manager
Super Manager
.nomedia Manager
.nomedia Manager

Download Super Manager Lite

Download StudioKUMA .nomedia Manager

[via XDA Developers]

32 Comments

  1. i have a problem with my whatsapp, the problem is that when i receive a picture in my whatsapp, a copy of the picture directly goes to my phone gallery, though i disabled media auto download but still the pictures directly comes to my gallery, another problem when i delete the downloaded picture inside the gallery then i can’t see it on my whatsapp page, instead there is a blurred picture which is not visible, i have to keep the copy in my gallery otherwise i can’t see it on my whatsapp page.
    if anybody has a solution please help me

  2. My watsapp number is banned please help me to reopen my no.9962108831 https://uploads.disquscdn.com/images/b9546237475c83931cffc62773e9b0836877be28c1a1e9e6a92a8ec380d65e65.png https://uploads.disquscdn.com/images/29060497ae92ef2c1f211a09358eac51dbd6f6ec44df43d73474ba3912f8bb12.png

  3. These tips don’t work, invalid filename. You can’t name a file with just an extension and no name for the file. And you can’t put a period at the beginning of a folder name. Both of these a suggestions are not allowed. I’m not sure how this is allowed to work for others on here. I can’t do it.

  4. Can someone please tell me how to STOP the recreation of “.nomedia” files automatically in a specific folder?? it really frustrating to delete that file just view back the photos from the album.
    Samsung S3 , CM 10.2.0 -i9300

  5. Thank you. The first two solutions are great to hide some media files from appearing in the gallery without installing another apps.

  6. I created the “.nomedia” file and all worked perfectly, but I cannot get back the images in the Gallery even though I deleted the “.nomedia” file!

    Any way to get the images in that folder to appear back in the Gallery?

  7. Sorry, this may be a slightly different topic but does anyone know how to prevent new blank DCIM and other similar folders from automatically being created in Android? (I have a HTC One M8 and this also happened on my HTC One model previously). The issue is, when I delete blank files such as download, .data, DCIM, and then open them via a PC connected to my phone, I can see new blank files have been created with the same name! It’s annoying as I’d like to just keep the folders which I actually will use. Any help would be greatly appreciated…

  8. This is such a useful tip.
    For folks that can’t make a .nomedia file, you can just search your android phone and I’m sure you’ll find an already existing copy of a .nomedia file. Use that to paste into whatever directory you don’t want scanned.
    Also, I wonder why Google does not include this feature as an option setting in the gallery / photos apps. I know that myself and many friends get frustrated deleting photos from the ebook directories etc.
    Anyhow, this tip has saved me lots of headaches.

  9. Tried option 1 with an Asus Transformer TF700T. No luck. Created a .nomedia.txt file with windows 7. Copied it to the tablet. Renamed it on the tablet to .nomedia. Copied the file to all of the directories I didn’t want the gallery to read. Did a force stop, clear cache and clear data on the Gallery app. Started Gallery and the folders were immediately displayed (it didn’t even have to refresh to see them). Tried doing a refresh. Still there.
    Tried Option 2. I have a folder with several sub folders under it with pictures. I renamed the root folder with the dot prefix. Then I turned the tablet all the way off and rebooted it. This time it worked.
    Maybe I should have tried cycling power after option 1?

  10. its working but when new images or videos comes into same directory that will be shown in gallery how to get ride of this.

  11. AAAAARRRRGGGGHHHH! I just downloaded the android update 4.1.2 for my Droid 4 phone. Originally I had used the .nomedia file method to keep certain folders from displaying in the Android gallery. After this update, initially the file doesn’t display in the gallery, however, the minute a new file is copied in there the file and the directory I don’t want displayed shows up. I’ve tried everything…changing the folder itself to a “.file” label, putting a text file called “.nomedia” in the file folder I don’t want displaying, putting a file folder called “.nomedia” in the file folder I don’t want showing, unmounting and removing the microSD card from the phone and plugging it back in, powering down and powering the phone back up again, and using various application editors to modify the file structure as well as the gallery itself. NOTHING WORKS!!!! Please help!

  12. I agree that image files are small in size but sometimes there is no need to download all images. In that scenario it’s useless. We need to manually remove unwanted images and it take long time and it’s a boring job.

    So, I think there should be a setting for to disable automatic download of images.

    Hope you understand.

    Thanks!
    Malay

  13. A had a bigger problem. I want to prevent also seleted type of media in shared directory.. For example I have music in MUSIC directory with jpg covers in subdirs, but I dont want to see each music dir in GALLERY app with its pictures… I want system to scan MUSIC directory just for audio media, PICTURES DIRECTORY just for pictures and video files and VIDEO directory just for video files. Is it possible?

  14. Perfect tip! I needed this.

    I tried to create a .nomedia file in win 7 that I could just drag and drop into select folders on my phone but win 7 does not allow for a blank filename. I created 1.nomedia, dragged those into my phone and used es filemanager to delete the “1” from the name.

  15. What about sub-directories? if I have a compete huge directory with many sub-directories is it enough to put in the parent one the .nomedia file or i need to put it also in each subfolder?

  16. you can use .nopicture (or maybe .noimage) on your music folder to hide all jpeg from your gallery. there is also the .novideo and .nomusic, I use them all the time to hide files selectively.

  17. I tried the .nomedia trick last night, but when I went to use Winamp this morning, it turns out .nomedia files will hide music from Winamp.

    I think I’m just going to delete the album art instead. I don’t need it, and it seems like a simpler solution.

    • That’s right. The .nomedia file will prevent all media files in its directory from being scanned, whether its by music players, video players or picture galleries.
      It might not be the solution to your album art problem, but you could use it to hide ringtones (stored on your SD card) from your Winamp playlist.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.