Not long ago while flipping through Reddit I came across a post of an internet stranger that had trouble hiding some image folders from WhatsApp’s Gallery: that is, the in-built gallery that scours your device’s storage for media and allows you to pick stuff to share or post.
What I found peculiar about his problem is that he had done everything right, and yet it had not worked as expected.
In Android, the quickest way to hide folders containing any kind of media (images, videos and audio) is to use a .nomedia file which tells media storage (i.e. Android’s system media scanner) and other media apps not to look in those particular folders.
Our friend here had done just that, and it had not worked out for him. So I tried on my phone and oddly enough, it didn’t work for me too. With no other solution at hand, I suggested he hide the complete folder by renaming it to start with a dot.
That was guaranteed to work, and it did for him, though in retrospect I wish I had suggested something better now that I’ve sort of figured out the cause behind this peculiar issue.
WhatsApp Ignoring .nomedia Files?
As it turned out, it wasn’t WhatsApp’s fault that its gallery wasn’t hiding the folders. That rested squarely on Android since WhatsApp seems to rely entirely on the system’s Media Storage to populate its gallery.
Now that could be an oversight on WhatsApp Devs since it’s a well-known fact that media storage is not the best of media scanners.
In the early days, at least from my Gingerbread experience, it was a resource hog. Five years later and nowadays, I’m realizing it just became “lazy”.
The stock gallery app on my marshmallow device was missing some media folders, and now it seems like it was blatantly “ignoring” all the .nomedia files I was creating. But was it?
File Manager’s Appending Attributes to .nomedia File
After further investigation, I came to find out the problem wasn’t media storage’s per se. The file manager I was using, and likely the one you’re using, is partly to blame.
Personally I’ve been a long time user of FX File Explorer, and it’s what I’ve been using all along to create .nomedia files. All the apps I typically use (QuickPic, MX Player) respect it’s .nomedia files with the exception of the Stock Gallery.
I realized this after using a different file manager (the excellent MiXplorer) to create the .nomedia file and surprisingly, this time it worked; both the stock gallery and WhatsApp had complied. But why?
Well I set out to investigate precisely that. What I found out after copying and comparing the two .nomedia files in my Windows 7 computer, is that they had different file attributes.
FX was creating the .nomedia with the A(rchive) attribute while the one from Mixplorer had the N attribute which after some Googling seems to indicate that it stands for Normal or No Attributes.
Not quite satisfied, I removed the A attribute from the file and copied it back to see the result. Sure enough it worked.
The problem it seems is that Media Storage simply just ignores .nomedia files with attributes. To verify my theory, I’ve since tried the same with another file manager (Amaze) and it failed to work for the same exact reason – the A attribute.
Solutions to the Attribute Problem
Since I don’t know the extent of this problem, let alone authoritatively verify its existence, my two cents are that should you find yourself in this situation, just try using another file manager to create the .nomedia file.
MiXplorer for one seems to work for me, though I’m sure it’s not the exception.
If you don’t want to install another file manager which is quite understandable, you can reuse a .nomedia file that already exists in your storage.
For instance, WhatsApp creates some in its Media subfolders. You can reuse those but make sure when copying that you use the Stock File Manager or the in-built Explorer found in the Storage and USB settings (Android 6.0 later).
I’m only saying that because in my case FX seems to give it the attribute when copying too.
A better way out of all this madness, which is rather trivial actually, is to just use apps that use their own media scanners. They’re way better than any of the stock apps anyway.
With regards to WhatsApp’s gallery, if you’ve never realized, WhatsApp does actually allow you from the three dots at the top left to use other gallery apps to pick content. You don’t therefore have to be stuck with the inept stock gallery.
On the other hand, if your primary concern is not to hide the clutter of unwanted media folders from your gallery but to keep prying eyes away, then you’re better off using something more secure like folder or gallery locker apps.
WhatsApp also introduced a way to hide media using private folders, however they rely on nomedia files to accomplish this.
If you take your privacy very seriously, apps that allow you to manually encrypt your files or folders should meet your needs. If not, perhaps consider not getting the need to hide anything in the first place. It’s no doubt the most secure and anxiety-free way.
Had the same problem after creating the file with TotalCommander. Using MiXplorer worked like a charm, thanks!
Glad to hear that Julian.
In my case, I just created a folder with the same name instead and it worked!
Got it to work by creating the .nomedia file on my desktop computer and moving it over to my phone.
Do you know how to do the opposite of this? I want my folder to be detected as a media folder even if it does not have any direct media in it. It has subfolders with media in it but the parent folder by itself is not a media folder cz it only contains folders.
(Reason for the same is complicated) but I appreciate any insight to add / force. Folder to mediastore
You could add an image or a small audio file to the folder itself and that should work; that’s the only workaround I can think of, though it seems like this may not be ideal for your situation.