Default Script to hide WhatsApp galery

Hi.

I need to hide the gallery WhatsApp (I know how to do it by file .nomedia) but each new file downloaded to gallery folder back to be displayed (with the files created after the creation of .nomedia only).
If access to the Media folder delete the WhatsApp .nomedia and create again the files are hidden.
To solve this I created this script:


#!/bin/bash
cd /storage/sdcard0/WhatsApp/Media/WhatsApp\ Video/
rm .nomedia
touch .nomedia
cd ..
cd WhatsApp\ Images/
rm .nomedia
touch .nomedia

But when run it does not hide the images. Apparently the file manager sends a command to "update" the files in that folder.

Someone can explain why this is?

I use a Samsung Galaxy SII i9100 with cyanogen mod v 10.1.3