Deleting Pictures through adb - Yet They Remain in Gallery I'm attempting to write a script to test out a camera for long periods of time, and one of the issues right now is the fact that it runs out of space when pictures are taken. My initial approach is to remove the picture using adb after its taken. The issue is, even after I remove it from the location it is saved in, it remains visible in the gallery, and I assume it's taking up space somewhere. The properties associated with it (such as width, height, flash info, etc) all get deleted as well, except for the size.

What I'm currently doing is deleting all files in the DCIM directory (where the camera saves the pictures) after every time a picture is taken, using adb. Additionally, when I search throughout the phone using adb, I cannot find anything similar to the pictures anywhere in the file structure.

Is it possible to fully delete the pictures using adb? Is there a cache where the images are stored somewhere? The only way I can get the pictures to fully be removed from the phone are to either reboot, or use monkey runner to delete the pictures through simulated touches in gallery (which is tedious for a large # of photos).
The reason the pictures remains visible in the Gallery is because the Android's MediaScanner is a bit weak in this regard. What happens is this - when Android boots up, it runs the MediaScanner, which goes off and checks all the images, ringtones, audio to sum up, and keeps tab on it. This is only done once on boot. 

You can get around this, by unmounting the SD Card, do this safely (Settings > Storage > Unmount SD Card) this will take a few seconds, once its unmounted, you can pop out the SD Card, pop it back in again, this in turn will force the MediaScanner to run again, and then all the images that you've deleted are no longer there in the Gallery.

MediaScanner is a service that acts as a caching service in that it caches all media (images/audio). On some ROMs, there is a facility to force it to run again without having to do the above.