With Calculate Folder Size Switched on / Network Calculate also.
Is there a way to cache folder sizes for a user specified time.
I.e. some of my folders are deep with many files and can take a little time to calculate
My problem at the moment is when I navigate to G:\ the autorefresh happens as something is being noticed by XY, so within a second or two of XY trying to calculate the folder sizes, it refreshes and starts the process again bit of a loop which can usually be stopped by pressing ESC.
Also when you navigate to a sub folder and then return to the parent (back button etc), the folder size process starts again, which can be time consuming on a network.
Obviously anyone using this feature would need to be aware of stale information but if it speeds up the use of XY I don't see a problem.
Feature added in 16.70
Cache Calculated Folder Sizes [feature added in 16.70+pro]
Cache Calculated Folder Sizes [feature added in 16.70+pro]
Last edited by neil9090 on 23 May 2016 14:42, edited 1 time in total.
Re: Cache Calculated Folder Sizes
You can easily achieve this by using a custom column and a script...
The script to write the folder size of the current selected folder into the tag database (I'm using extra column 1 in this case):
And this is the definition of the custom column you have to add:
Script:
The script to write the folder size of the current selected folder into the tag database (I'm using extra column 1 in this case):
Code: Select all
if (exists("<curitem>") == 2) {
tagitems("ex1", foldersize("<curitem>", "<r>"));
#195; // Save the tags database
#485; // Refresh the list immediately to display the new size
} else {
status "No folder selected, no caching done...";
}
Script:
Code: Select all
return formatbytes(tagitems("ex1", , "<cc_item>"), "FLEX");
One of my scripts helped you out? Please donate via Paypal
Re: Cache Calculated Folder Sizes
Thanks highend, I was hoping that Don would be able to add the Cache into XY thus in the wish list, I found a similar script here back in 2014 after I had posted.
http://www.xyplorer.com/xyfc/viewtopic. ... es#p133731
So will probably merge a bit of the your script and the other script.
Thanks for sharing another method, script worked as expected.
I already have a 80k (24mb) Tag file... working really well, although I think I would have to adapt your script as it takes a few seconds to save the settings/tags.
I think I will limit the folder size script based on path so not too many are stored automatically via a column script.
Would be nice if XY could do some sort of background/async script so the columns don't hold up the UI when doing slow processing jobs.
http://www.xyplorer.com/xyfc/viewtopic. ... es#p133731
So will probably merge a bit of the your script and the other script.
Thanks for sharing another method, script worked as expected.
I already have a 80k (24mb) Tag file... working really well, although I think I would have to adapt your script as it takes a few seconds to save the settings/tags.
I think I will limit the folder size script based on path so not too many are stored automatically via a column script.
Would be nice if XY could do some sort of background/async script so the columns don't hold up the UI when doing slow processing jobs.
Re: Cache Calculated Folder Sizes
Yeah, that would be really a nice thing to have... but I'm waiting for threading since... *** a little bit of time ***Would be nice if XY could do some sort of background/async script so the columns don't hold up the UI when doing slow processing jobs.
One of my scripts helped you out? Please donate via Paypal
Re: Cache Calculated Folder Sizes
We could probably speed that up a bit (by using a regexreplace and fileread / write). The interesting question is: How long does XY need to reload the tag database afterwards...I already have a 80k (24mb) Tag file... working really well, although I think I would have to adapt your script as it takes a few seconds to save the settings/tags.
For example, on a 9 MB testfile, the reading, replacing a line and saving does take about ~280 msecs. * 3 (your 25mb+ file) =~ 1 second. Core I5, 3,2 GHz, SSD
Your "few seconds". How long does it take exactly?
Do me a favor and run this little script to see if reloading the db doesn't take too much time...
Code: Select all
$start = now("msecs");
#887;
text (now("msecs") - $start) . " msecs";
One of my scripts helped you out? Please donate via Paypal
Re: Cache Calculated Folder Sizes
Reloading tag via your script;
some example times;
1014 msecs
905 msecs
952 msecs
967 msecs
1076 msecs
Filesize of tag is actually 36,051,808 bytes
Saving tagfile only; (#195;)
some example times
1529 msecs
1498 msecs
1451 msecs
1388 msecs
1560 msecs
Not using a SSD (would like to) 5400 HD, i7 2630 Laptop.. ~2 Ghz
some example times;
1014 msecs
905 msecs
952 msecs
967 msecs
1076 msecs
Filesize of tag is actually 36,051,808 bytes
Saving tagfile only; (#195;)
some example times
1529 msecs
1498 msecs
1451 msecs
1388 msecs
1560 msecs
Not using a SSD (would like to) 5400 HD, i7 2630 Laptop.. ~2 Ghz
Re: Cache Calculated Folder Sizes
Ok, the "a few seconds" are only 1,5 instead?
From your values: Nothing to optimize here...
From your values: Nothing to optimize here...
One of my scripts helped you out? Please donate via Paypal
Re: Cache Calculated Folder Sizes
Feels longer, and I guess I was clicking the save setting (all) which might make it 2 seconds..
And my machine sometimes goes slow (my issues)!
With many folders being stored the size it adds to the ever growing tag file, but it doesn't seem to make a difference at the moment, if Don could get a cache setting in place instead of having to either use a column or tag field that would be good.
What would be nice is a new column trigger type Display and Click, i.e. show the last value stored aka folder size, but click the column and it would refresh if there was a trigger timeout to refresh after (10 minutes for example).
Obviously all would be solved with background threading of columns/scripts. Although using trigger type "list" might be a solution, but haven't used that much to see how well that works.
And my machine sometimes goes slow (my issues)!
With many folders being stored the size it adds to the ever growing tag file, but it doesn't seem to make a difference at the moment, if Don could get a cache setting in place instead of having to either use a column or tag field that would be good.
What would be nice is a new column trigger type Display and Click, i.e. show the last value stored aka folder size, but click the column and it would refresh if there was a trigger timeout to refresh after (10 minutes for example).
Obviously all would be solved with background threading of columns/scripts. Although using trigger type "list" might be a solution, but haven't used that much to see how well that works.