DonManfred,
Thanks for your response.
Initially my response to yours was "????" (well in the Australian vernacular it was a good bit coarser
).
But it made me do a lot of googling which made me realise I didn't have a clue what the media scanner was or what the code in my first post was doing.
I eventually came across a one line summary of what the media scanner does:
The media scanner just scans through all of the files on external storage, collecting meta-data about them to populate the media database so you can do queries on them.
Simple and authoritative - well it should be as it was written by a "Android framework engineer".
Other reading suggests this scanning process can lag generation of new media files like .jpg, .mp3 etc
So theoretically if a .jpg is filed on File.DirRootExternal sooner or later the media scanner will find it and add it to the photo gallery.
What the code in the first post does is just removes the "sooner or later" element from the previous sentence.
So the code in the first post has nothing to do with the "bizarre behaviour" I thought I was observing - in fact that "bizarre behaviour" was just the media scanner doing what it was supposed to do.
And your comments about using .nomedia blank files to vary that behaviour are well worth noting strongly.
Thanks again - I am better informed and content - at least on this front...