Page 1 of 1
Deletion of Thumbnails
Posted: 06 May 2014 19:33
by outskirter
If I empty one folder that previously contained images for which XYplorer had created thumbnails, is there an easy way of deleting the thumbnails from the cache? Obviously I wouldn't want to delete all of my thumbnails, otherwise I'd have to regenerate them. Up 'til now I've been opening XYThumbs.txt to figure out which of the thumbnails are no longer valid. Sometimes a lot of them are left behind, and they're kind of awkward to find due to those long hexadecimal file names.

Re: Deletion of Thumbnails
Posted: 07 May 2014 04:46
by binocular222
http://www.xyplorer.com/xyfc/viewtopic. ... =15#p90973Code: Select all
$thumbsmod = ""; $thumbssync = "";
$dat2 = formatlist(folderreport("files", "r", "<xythumbs>", , , "<crlf>"), "f", "<crlf>", "*.dat2");
if (confirm(quote("OK") . " to recreate and sync your your XYthumbs.txt file with<crlf>the thumbnnail data files after thumbnail cleanup, or<crlf 2>" . quote("CANCEL") . " to update XYthumb.txt only after cleanup.")) {$sync = "1";}
foreach($dat2file, $dat2, "<crlf>") {
$filehash = getpathcomponent($dat2file, "base"); //gets the base file name which is the "hash"
$dat2info = readfile("$dat2file", "b", 85, , 17); //reads each thumbnail ".dat2" file for the folder and thumbnail size
$thumbsfolder = gettoken($dat2info, 1, "*", "t"); //extract the folder
$thumbssize = gettoken($dat2info, "2", "*", "t"); //extract the thumbnail size
$filedate = property("#3", "$dat2file"); //obtains the file date
if !(exists($thumbsfolder)) { //adds a pre-checked "+" for inputselect for folders that do not exists.
$thumbsmod = $thumbsmod . "+" . $thumbsfolder . "|" . $thumbssize . "|" . $filedate . "|" . $filehash . "<crlf>";}
else {$thumbsmod = $thumbsmod . $thumbsfolder . "|" . $thumbssize . "|" . $filedate . "|" . $filehash . "<crlf>";}
if ($sync == "1") {
if !(exists($thumbsfolder)) { //adds a pre-checked "+" for inputselect for folders that do not exists.
$thumbssync = $thumbssync . "+" . $thumbsfolder . "|" . $thumbssize . "|" . $filehash . "<crlf>";}
else {$thumbssync = $thumbssync . $thumbsfolder . "|" . $thumbssize . "|" . $filehash . "<crlf>";}
}
}
$thumbsmod = formatlist($thumbsmod, "se", "<crlf>");
if ($sync == "1") {$thumbssync = formatlist($thumbssync, "se", "<crlf>");}
else {$thumbstxt = readfile("<xythumbs>\XYthumbs.txt");}
$sel_hash = inputselect("Select Thumbnails files to delete<crlf>based on folder location, thumbnail size and date.<crlf>Pre-checked folders no longer exist.", $thumbsmod, "<crlf>", 2, , 800, 800, "Thumbnail File Selection");
foreach($hash, $sel_hash, "<crlf>")
{
$hash = gettoken($hash, -1, "|"); //pull-out the hash only portion of line
delete 0, 0, "<xythumbs>\". $hash .".*"; //change 2nd parameter to "1" to prompt prior to deleting
if ($sync == "1") {$thumbssync = regexreplace($thumbssync, ".*".$hash.".*$\r?\n?");}
else {$thumbstxt = regexreplace($thumbstxt, ".*".$hash.".*$\r?\n?");}
}
if ($sync == "1") {
copytext "XYplorer Thumbs Index v1<br><date yyyy-mm-dd hh:mm:ss><br><br>";
copytext $thumbssync, a ;
$newThumbsTxt = "<clipboard>";
writefile("<xythumbs>\XYthumbs.txt", $newThumbsTxt, "o", "tu"); //writes a new XYthumbs.txt file based on actual thumb data and cleanup
status "XY thumbnail clean-up complete and XYthumb.txt regenerated and synced with thumbnail data files.";
}
else {
writefile("<xythumbs>\XYthumbs.txt", $thumbstxt, "o", "tu"); //updates the XYthumbs.txt based on cleanup
status "XY thumbnail clean-up complete and XYthumb.txt updated.";
}
Re: Deletion of Thumbnails
Posted: 07 May 2014 07:05
by outskirter
Thanks, binocular222. I must have missed that post, since I tend to avoid scripting discussions, finding them too technical. I'm using XYplorerFree, anyway, so scripts are not an option. What I had in mind was opening a folder, going to the thumbnail config dialogue, directly or by right-clicking the thumbnail button on the toolbar, and issuing a command to clear the thumbnails for the current folder.
Re: Deletion of Thumbnails
Posted: 07 May 2014 07:39
by binocular222
Without script:
- Open \\XYplorer\Data\Thumbnails\XYThumbs.txt
- Find any invalid/empty folder path
- Delete the relevant *.dbits files
Re: Deletion of Thumbnails
Posted: 07 May 2014 15:48
by outskirter
binocular222 wrote:Without script:
- Open \\XYplorer\Data\Thumbnails\XYThumbs.txt
- Find any invalid/empty folder path
- Delete the relevant *.dbits files
Thanks, that's exactly what I've been doing all along.
Re: Deletion of Thumbnails
Posted: 07 May 2014 16:49
by binocular222
Honestly, you should consider upgrading to full version.
Scripting brings XY to a totally new level of speed, automation and usability. Catalog is nice too.