Clear Folder Size Cache On Exit

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
virtualrab
Posts: 3
Joined: 25 Mar 2017 16:16

Clear Folder Size Cache On Exit

Post by virtualrab »

Hello,
Is there a way to clear the Folder Size Cache each time I exit/close XYplorer?
Thank you

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

Re: Clear Folder Size Cache On Exit

Post by highend »

Configuration | General | Custom Event Actions
Other Events
Exit

Action = Run script

Code: Select all

    $batFile    = "%TEMP%\~xy_delete_fsc.bat";
    $batContent = <<<>>>
@echo off
:CheckProcess
tasklist | findstr /i "xyplorer.exe" >nul 2>&1
if %ERRORLEVEL% == 0 (
    timeout /t 2 >nul
    goto CheckProcess
)
timeout /t 2 >nul
del /f /q "<xydata>\fsc.dat"
    >>>;
    $result = writefile($batFile, $batContent, , "utf8");
    if ($result != 0) { run lax("cmd" /c "$batFile"), "%TEMP%", 0, 0; }
One of my scripts helped you out? Please donate via Paypal

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Clear Folder Size Cache On Exit

Post by jupe »

Theoretically, I think if you just make the fsc.dat file read only it will perform as you wish (session only cache), empty its contents too if desired, so it is 0 bytes.

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

Re: Clear Folder Size Cache On Exit

Post by highend »

You would get an access denied message box every time you save settings / exit XY
One of my scripts helped you out? Please donate via Paypal

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Clear Folder Size Cache On Exit

Post by jupe »

Ah ok, I hadn't tested the theory, another theory then to workaround that is you could instead set a cea exit event that used SC savesettings to only save the files you wanted, and disable the main config setting.

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

Re: Clear Folder Size Cache On Exit

Post by highend »

Wouldn't work as well, the fsc.dat is saved regardless if you disable the save settings on exit :)
One of my scripts helped you out? Please donate via Paypal

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Clear Folder Size Cache On Exit

Post by jupe »

Are you sure?

I don't use Folder Sizes so am not that familiar with the dynamics, but from memory of testing I think you are mistaken.

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

Re: Clear Folder Size Cache On Exit

Post by highend »

Yeah, I‘ve tried it before I wrote the script
One of my scripts helped you out? Please donate via Paypal

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Clear Folder Size Cache On Exit

Post by jupe »

Strange, after a quick test I can't confirm fsc.dat getting saved when the main save settings on exit config option is disabled, but maybe there are other factors at play.

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

Re: Clear Folder Size Cache On Exit

Post by highend »

Very strange, I've tried it several times with 0700 and it saved the file cache each time with save settings on exit disabled...

I find the behaviour of savesettings strange as well.

1023 = all
savesettings 1023; = No fsc.dat is created
savesettings; = fsc.dat is created
One of my scripts helped you out? Please donate via Paypal

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

Re: Clear Folder Size Cache On Exit

Post by admin »

fsc.dat is written only if the cache is dirty (if it is assumed to be different from the contents of fsc.dat).

Post Reply