Script: Thumbnail Maintenance

Discuss and share scripts and script files...
klownboy
Posts: 2702
Joined: 28 Feb 2012 19:27

Re: Script: Thumbnail Maintenance

Post by klownboy » 22 Oct 2015 14:06

Thanks Enternal. Maybe I should have named the script Thumbnail Toolbox. :)

Hadden
Posts: 13
Joined: 03 Feb 2016 15:51

Re: Script: Thumbnail Maintenance

Post by Hadden » 03 Feb 2016 20:41

I use thumbs alot. (10 gb of thumbs lol)
Can you explain how act the different modes in the script?
For example, I want to remove only thumbs in folders I don't visit often while keep always thumbs in "x" folder. It's possible?

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

Re: Script: Thumbnail Maintenance

Post by klownboy » 04 Feb 2016 01:43

Hi Hadden, I think the option best for you is the very first one in the menu if you want to delete thumbnail caches. The first couple of menu items work directly form the thumbnail cache database. Whereas, most of the others are re-building the thumbnail caches based on your current folder. Some of the folder options will also give you before and after cache size information. The first menu item is for deleting caches and the second for rebuilding caches. You simply check of the folders of thumbnails you know longer need. Keep in mind, some folders may have thumbnails in more than one size, so pay attention to the size as well. In other words, there may be one important image folder you want to save the thumbs in one particular size, but delete the thumbs for a different size. The script will also pre-check any caches where the associated image folder no longer exists or there are no images in the folder(s).

Please give the first couple of menu items a few seconds to display since its looking over a large amount of information especially if you have very large number of caches.

There's good reason to rebuild the caches since when you delete, move and rename image files, the old thumbnails will remain in the cache. So rebuilding will clean the folders of excess thumbs no longer needed or when the image no longer exists in the folder. If the folder hasn't been re-built in some time, it may cut the cache size down significantly.

To rebuild caches of existing image folders it's sometimes best to use the 2nd menu item. There you can check off what caches you want to rebuild.
In that menu you'll see a listing similar to the listing here http://www.xyplorer.com/xyfc/viewtopic. ... 45#p110631 - the post dated 26 Aug 2014 08:33. That particular post will give you a better explanation of the menu options as well.

Good luck.

Hadden
Posts: 13
Joined: 03 Feb 2016 15:51

Re: Script: Thumbnail Maintenance

Post by Hadden » 04 Feb 2016 14:45

Ok, I'll save the menu-script-guide then ;)
I often use several thumbs mode (recently I use 128x128 and 300x350) but I want to purge alot of thumbs (expecially >350 I'm not using anymore) and for file I deleted/moved.
Thanks, I'll look better what can I do.
*EDIT*
Simply with first option - cutting out thumbs >128 (expect 300x350) - I cleaned 7 gb. Now is a resonable 3 gb of thumbs. Thanks again.

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

Re: Script: Thumbnail Maintenance

Post by klownboy » 04 Feb 2016 15:05

Hadden wrote:Simply with first option - cutting out thumbs >128 (expect 300x350) - I cleaned 7 gb. Now is a resonable 3 gb of thumbs.
That's great. Now once you've deleted the caches you no longer need or use, you can use the second menu option to rebuild some of the caches of the folders/thumb sizes you've kept. A rebuild can take some time especially if you're dealing with a huge amount of images in a folder, so I'd only select 1 or 2 at a time to see how it works. It's the image folders where you have done a significant amount of deleting, renaming or moving of files where you'll see a notable decrease in size of the cache upon a rebuild. If you haven't done much with a folder then no you will not.

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

Re: Script: Thumbnail Maintenance

Post by klownboy » 03 Oct 2016 17:51

Thumbnail Mainterance v1.18
The main purpose of this revision is to better recognize the thumbnail Zoom-to-Fill option in XYplorer's configuration. It will distinguish between normal thumbnails in the cache databases and Zoom-to-Fill cache for a particular folder. For those who may use Zoom-to-Fill for some image folders and normal thumbs for other image folders this may be handy.
1.) If you use a Menu option which based on the XY's thumbnail database, the caches for a particular folder with Zoom-to-Fill will be shown with a "z" after the thumbnail size. So if you are deleting or rebuilding thumbnail caches you can decide which database cache you'd like to keep/rebuild/delete (i.e., the normal cache (no Zoom-to-Fill) or the cache with Zoom-to-Fill).
2.) If you are using one of the menu options that are based on the current folder or current folder and subs, the cache to be rebuilt or refreshed will be based on your "current" configuration (i.e., whether Zoom-to-Fill is ON or OFF). So if you currently have Zoom-to-Fill ON, the thumbnails refreshed or rebuilt will be in the Zoom-to-Fill mode.

I've had this change done since March, but got side tracked and never uploaded.
ThumbnailMaintenance_v1.18.zip
(323.43 KiB) Downloaded 157 times
Thanks

SammaySarkar
Posts: 4190
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Script: Thumbnail Maintenance

Post by SammaySarkar » 23 Mar 2017 18:58

Hey ken, maybe the script should disable background file ops when deleting caches. After running a cleanup, at one point I found > 181 XYCopy processes running in my process manager, because I had closed the parent XYplorer process before all those BG operations finished.

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

Re: Script: Thumbnail Maintenance

Post by klownboy » 23 Mar 2017 20:57

Ok Sammay I made a note for the next change. It looks like it would be just a matter of using SC setting "BackgroundFileOps", 0 up front and using restore [r] when exiting the script. Thanks.

PeterH
Posts: 2575
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Script: Thumbnail Maintenance

Post by PeterH » 24 Mar 2017 00:06

Not sure I understand you right about "restore"?

You know that command "setting" is only temp, for the time of the script - when the script terminates the setting is reset automatically.
(There is an operand "p" for permanent.)
W7(x64) SP1 German
( +WXP SP3 )

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

Re: Script: Thumbnail Maintenance

Post by klownboy » 24 Mar 2017 12:26

Hi PeterH, the way I understood it is, the 'r' would restore what ever the user had for a setting before the script was run. So if someone had BackgroundFileOps already disabled before the script was run, and I disable it in the beginning of the script [0] then nothing is actual done by the restore value in this case. If it was enabled before the script was run then it would be restored to enabled upon completion of the script. I understand that it's only temporary. I wouldn't want to change a user's setting permanently. Maybe I'm misreading the help file.

PeterH
Posts: 2575
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Script: Thumbnail Maintenance

Post by PeterH » 24 Mar 2017 12:36

Hm - still irritated.

If it's temporary, you don't need to reset it at the end. That's automatic.
You only have to reset it if you want the original (= previous) state to be active for further execution of the current script.
W7(x64) SP1 German
( +WXP SP3 )

SammaySarkar
Posts: 4190
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Script: Thumbnail Maintenance

Post by SammaySarkar » 24 Mar 2017 13:25

setting reference > Usage header wrote:Note that restoring options to their previous values, or user values, is not required: all modified options are restored automatically by XY when script execution ends (unless specified otherwise by using "p" as third parameter) regardless of how the script ended: normal termination, error, user cancellation...

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

Re: Script: Thumbnail Maintenance

Post by klownboy » 24 Mar 2017 13:26

I hope you're not too irritated with me. I was only trying to interpret the help file (albeit incorrectly).

So based on what you are saying (and the help file), there shouldn't be any reason for me to use the [r] 'restore' at the end of the script since it's only temporary setting which will expire at script completion. The script writer would use [r] restore only for situations where the script may need to restore the original value somewhere within the script and not wait until the end. Good to have that clarified. I used the restore in at least one other script where I didn't need to (now where was that). In the end though, there's no real harm in it it's simply unnecessary. Thanks PeterH and Sammay. :tup:

PeterH
Posts: 2575
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Script: Thumbnail Maintenance

Post by PeterH » 24 Mar 2017 15:18

If I see it right you now have every aspect of it :appl: :D :appl:
W7(x64) SP1 German
( +WXP SP3 )

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

Re: Script: Thumbnail Maintenance

Post by klownboy » 24 Mar 2017 15:26

It should have clicked after your first post. I just had inguinal hernia surgery the other day. Maybe the groin pain went to my brain. Thanks again.

Post Reply