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]

Advertisement
  • Mercnerd

    Good One.. Something that i was pulling my hair about… :D

  • c0d3r

    Awesome tip :) Really needed it ! Thanx :D

  • Jonneh

    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.

    • http://www.addictivetips.com/ Sameed

      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.

  • Coumbaya

    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.

    • Igor Kolenič

      it seems that this solution isnt working…

  • mcbyte

    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?

    • Souldier_

      Trial and error my friend.

    • http://www.addictivetips.com/ Sameed

      Placing a .nomedia file in the parent directory will prevent any subdirectories from being scanned as well.

  • Davesonfire

    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.

  • Guest

    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?

  • http://www.facebook.com/malay.ladu Malay Ladu

    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

  • Guest

    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!

  • gurpreet

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

  • Ashish

    Excellent Tip

  • fpjohny

    I have try method two.how can i undo this change? Please help

  • DebsDroid

    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?

  • Bharath

    Thank you. A very useful tip. Is there a way to disable a parent directory from being scanned, but allow a child?

  • Alan Galiwango

    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.

  • Alain Attias

    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…