Thumbnail database retains thumbs after all images are deleted

Things you’d like to miss in the future...
klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Thumbnail database retains thumbs after all images are deleted

Post by klownboy »

I had a folder loaded with JPGs at one point that were deleted long ago. Nothing remained in that folder. I noticed that the associated "dat2" and "dbits" files were still in the thumbnail database for that folder and still contained the contents for those JPG thumbs.. So, I decided to run a thumbnail refresh CID #501 to see if the thumbnails in the database would be removed. They were not. I expected the thumbnail database size to at least go down and no longer reflect the 10 files that were long deleted, but no. I ran more tests to confirm both with a folder under the subject folder and with nothing remaining in the subject folder (after the image deletions). All came to same result.

Very easy to recreate:
(1) Make a new folder "Temp", and
(2) add a bunch of JPGs to it.
(3) Make sure all is properly saved, and
(4) look at the thumbnail database files associated with that folder (e.g., size, etc.).
(5) To be sure, run a refresh thumbnails and relook at the same thumbnail database files should be the same obviously.
(6) Now delete those image files added earlier (Edit: after deleting the images, I looked at the dat2 and dbits file sizes/contents - as I expected - no change), and
(7) Re-run Refresh thumbnails on the subject folder.
(8) You will noted that the database files have not changed. No reduction of size to reflect that the files are no longer in the folder. This is what surprised me.

Don after operations like this shouldn't the database files for the folder be cut down to a minimal size or even better, simply be deleted by XY. After all, there are no thumb-able images (no nothing) remaining in that folder. If someone later was to add images new thumbnail database files would be generated anyway. Restarting doesn't affect this situation either. Removing the thumbnail Folder View Settings also doesn't affect the database files. Thanks.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Thumbnail database retains thumbs after all images are deleted

Post by admin »

What you see is the same strategy that Windows applies when files are deleted (as opposed to wiped). The data still exist but are marked as obsolete. They will be overwritten whenever new thumbnails are created in that location. This strategy saves time and energy, but admittedly it does not save space. Also, in case you delete images to the recycler and then restore them, the cache is still there. :)

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Thumbnail database retains thumbs after all images are deleted

Post by klownboy »

Yes, I see what you're saying Don, in that when the images are deleted, they are still available in a sense and and possibly be in the re-cycle bin (if enabled). I think though in the case of XYplorer, when the user purposely runs CID #501 to rebuild or refresh after the image deletions in a folder, those thumbnails should be wiped. Taking it one step further, when #501 is run in this case (i.e., when no thumb-able images remain in the folder), the 2 database files could or should be deleted.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Thumbnail database retains thumbs after all images are deleted

Post by admin »

I'll consider this, thanks.

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Thumbnail database retains thumbs after all images are deleted

Post by klownboy »

Thanks Don.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Thumbnail database retains thumbs after all images are deleted

Post by klownboy »

Hi Don, I know you're still considering this, but I was thinking tonight that maybe a possible solution would be through the use of a modified CID #501 or another command or script function such if the command is used and there are no remaining thumb-able images in the folder, that would trigger the associated dat2 and dbits files to be deleted. If an individual uses the menu item to refresh thumbnails, the result would be the same as it currently is - safe in case they wanted to use the recycle bin. This way when scripting we would get the full desired result and the someone simply using the menu would get the current behavior.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Thumbnail database retains thumbs after all images are deleted

Post by admin »

I went for this solution:

Code: Select all

    ! Thumbnails Cache: When a list is completely empty but a pair of thumbnail 
      cache files for it still exists (for images that are not here anymore) 
      calling "View | Caches | Refresh Thumbnails" (only possible in a view with 
      thumbnails) will now delete those thumbnail cache files.
Okay for you?

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Thumbnail database retains thumbs after all images are deleted

Post by klownboy »

That's great Don. :tup: :appl: Correct me if I'm wrong, but if someone was to recycle the actual deleted images into the folder again, wouldn't XYplorer do its normal thing of automatically generating the thumbnails anyway?
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Thumbnail database retains thumbs after all images are deleted

Post by admin »

I think so. Try it. :)

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Thumbnail database retains thumbs after all images are deleted

Post by klownboy »

Yes, I tested the new feature and XYplorer did delete the 2 thumbnail database files, dat2 and dbits. I restored a few files to the folder and the same database files were recreated. :tup:
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Thumbnail database retains thumbs after all images are deleted

Post by klownboy »

Hi again Don, I noticed when doing further checks on this v22.70.0021 thumbnail change that the thumbnail database files are not deleted if there is a sub-folder remaing in the folder when all the image files are deleted and "refresh thumbnails" is done. The beta notes state Thumbnails Cache: When a list is completely empty but a pair of thumbnail
cache files for it still exists
so I take "completely empty" really means completely empty not just the images but a folder as well.

In my test case the subfolder didn't have a thumbnail - it was just the generic one and it wasn't listed in the dat2 file. Why not wipe the thumbnail database files in that situation as well when any subfolder(s) is not thumbed? Or is it too much decision making?
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Thumbnail database retains thumbs after all images are deleted

Post by admin »

Too much for now. :)

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Thumbnail database retains thumbs after all images are deleted

Post by admin »

Had a little idea. All will be to your liking in the next version. :beer:

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Thumbnail database retains thumbs after all images are deleted

Post by klownboy »

Okie Dokie and thanks. I was just listening to Strawberry Alarm Clock. I bought this album in 1967. https://www.youtube.com/watch?v=4rw1_FNdy-Y It's funny watching that now. I had never seen it. The only albums I bought before this were the Beatles.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Thumbnail database retains thumbs after all images are deleted

Post by admin »

Ha, reminds me of this: https://www.youtube.com/watch?v=jU9yFCZqdyE (best feedback in music history at 1:20)

Post Reply