Folder size and Caching

Features wanted...
Filehero
Posts: 2721
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: Folder size and Caching

Post by Filehero »

DmFedorov wrote:Now i can not reproduce this. Excuse me.
No worries. I'm just happy I don't have a major issue here.


Cheers,
Filehero

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

Re: Folder size and Caching

Post by admin »

highend wrote:Is this intended?

When I extract a .zip archive with context menu - Zip - Extract here
the cached! folder size view is refreshed (or recalculated?) multiple times during extraction (probably because of having more than one file in the archive).

Auto-refresh is on but
Configuration | Refresh, Icons, History | Auto-Refresh | Refresh during file operations
is off
This is normal. Zip extraction does not count as "file operation" in this context.

The sizes are not recalculated, just read from the cache.

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

Re: Folder size and Caching

Post by admin »

LittleBiG wrote:
admin wrote:Fascinating how simple ideas become more and more complex once they get in touch with reality.
Indeed. However, I realized what I wrote sounds complicated. It simply means that "Clear Folder Size Cache" should be a way to be partial. (Clear cached sizes in the current folder and its subfolders).
I'm not sure yet if and what to do about this. Needs more thinking.

LittleBiG
Posts: 1848
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: Folder size and Caching

Post by LittleBiG »

LittleBiG wrote:
admin wrote:Fascinating how simple ideas become more and more complex once they get in touch with reality.
Indeed. However, I realized what I wrote sounds complicated. It simply means that "Clear Folder Size Cache" should be a way to be partial. (Clear cached sizes in the current folder and its subfolders).
If this partial clear existed and was added to the scripting somehow like ClearSizeCache($foldername,"recursive"), a very exciting thing could be scripted. Imagine a permanent variable with this content:

Code: Select all

$pv_RefreshCache = "C:\Downloads\,20160523,10|D:\Documents\,20160522,3"
meaning: Folder To Refresh, Last Refresh Date, Frequency
It would be very easy to write a script in the PFA matching all folders. So when you entered a folder, it would check if the folder is in the permanent variable, so it is subjected to regular refresh, and according to the date and frequency, it would run the new ClearSizeCache command on the folder you have just entered. Then would modify the Last Refresh Date to the current.

Sorry for daydreaming but this kind of excitement couldn't be achieved by any other so called file manager.

EDIT:
admin wrote:I'm not sure yet if and what to do about this. Needs more thinking.
Noted. *sigh*

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

Re: Folder size and Caching

Post by admin »

ClearSizeCache... hmm, isn't that a bit over the top? I know things that are even more exciting than clearing parts of a cache via scripting... :ninja:

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

Re: Folder size and Caching

Post by admin »

LittleBiG wrote:If I decide to use Calculate Folder Sizes to refresh the cache, after refreshing please delete the subfolders from the cache. Otherwise very weird sizes can happen. Think about the situation, when you have the Downloads folders with subfolders Movie, Games, Music and so on, and the next subfolder level like Games/Shooter, Games/Adventure, Movie/Romance, Movie/Comedy and so on. If I have downloaded things, the easiest way to refresh the cache is to recalculate the size of the Downloads folder. If subfolders are not deleted from the cache, I have to find some workaround or I have to visit each subfolder and refresh their size too.
What about this: When calculating a nested folder, all calculated subfolders are written to the cache as well right away.

Advantages:
- Your problem disappears. All subfolders are updated right away.
- Going down into a cached folder will be totally fast, since all subfolders are also already cached.

Disadvantage:
- The cache will be bigger. Maybe much bigger. (But not slower, don't worry. I use binary search here, so it's lightning fast in any size).

highend
Posts: 14641
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Folder size and Caching

Post by highend »

As long as it's not suffering from it's own size and it's just text entries... I'd vote for storing subfolders as well
One of my scripts helped you out? Please donate via Paypal

DmFedorov
Posts: 715
Joined: 04 Jan 2011 16:36
Location: Germany

Re: Folder size and Caching

Post by DmFedorov »

admin wrote:When calculating a nested folder, all calculated subfolders are written to the cache as well right away.
I vote for this too.

LittleBiG
Posts: 1848
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: Folder size and Caching

Post by LittleBiG »

admin wrote:What about this: When calculating a nested folder, all calculated subfolders are written to the cache as well right away.

Advantages:
- Your problem disappears. All subfolders are updated right away.
- Going down into a cached folder will be totally fast, since all subfolders are also already cached.

Disadvantage:
- The cache will be bigger. Maybe much bigger. (But not slower, don't worry. I use binary search here, so it's lightning fast in any size).
Hehe, you approached it from the other end. I can see only one advantages comparing with partial delete: going down is fast.
Every other aspect is better in case of partial delete:
1. In case of root folder, the whole hard drive will be cached in one go?
2. The cache will be smaller using partial delete, cutting back is good for speed. Your solution means the very opposite.
3. The size of subfolders will be calculated only when I enter the folder. If I don't use a folder for a while, why to cache it in advance?

EDIT: hm I am wondering that if the fsc.dat is a textfile is it possible to create a button which deletes the subfolders from the cache first then starts the size calculation? Or is it too risky to do by myself?

LittleBiG
Posts: 1848
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: Folder size and Caching

Post by LittleBiG »

DmFedorov wrote:
admin wrote:When calculating a nested folder, all calculated subfolders are written to the cache as well right away.
I vote for this too.
I vote for the opposite. To cache only what is necessary.

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

Re: Folder size and Caching

Post by admin »

LOL. Nothing is easy.

Well, doing a whole drive indeed appears a bit frightening. What about doing just 1 or 2 levels below the top folder that's being calculated?

highend
Posts: 14641
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Folder size and Caching

Post by highend »

Why not just the first subfolder(s) of the current folder to cache (without any further recursion)?
One of my scripts helped you out? Please donate via Paypal

LittleBiG
Posts: 1848
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: Folder size and Caching

Post by LittleBiG »

LittleBiG wrote:Additionally, I wouldn't cache the [Empty] folders. It will be very misleading when some file will be added and the cache still shows empty. It is worse than a not quite exact folder size.
I would like to bring this to your attention with the addition that zero size also shouldn't be cached. I have just unzipped something into a new folder. Its size was cached 0 (because WinZip created the folder first than started to fill with the data), however I unzipped more than a gigabyte into that folder...

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

Re: Folder size and Caching

Post by admin »

highend wrote:Why not just the first subfolder(s) of the current folder to cache (without any further recursion)?
Yep, exactly what I will do.

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

Re: Folder size and Caching

Post by admin »

LittleBiG wrote:
LittleBiG wrote:Additionally, I wouldn't cache the [Empty] folders. It will be very misleading when some file will be added and the cache still shows empty. It is worse than a not quite exact folder size.
I would like to bring this to your attention with the addition that zero size also shouldn't be cached. I have just unzipped something into a new folder. Its size was cached 0 (because WinZip created the folder first than started to fill with the data), however I unzipped more than a gigabyte into that folder...
Good idea! Done.

Post Reply