Page 1 of 2

Bug or feature? File size does not refresh

Posted: 2024-02-17, 12:03 UTC
by MaxX
TC does not show actual file size just at the moment that file is being donloaded by browser or ffmpeg output.
Then I open the same folder with 7-zip (7zFM.exe) in background. Now TC shows actual increasing file size.
Then I close 7-zip. Now TC don't update file size any more, just until write process finishes.

I remember, that it worked for years before, but not now. Any ideas?

TC 11.02, Win10 21H2 x64
My config -- https://i.imgur.com/kPldr0N.png

Re: Bug or feature? File size does not refresh

Posted: 2024-02-17, 12:08 UTC
by Horst.Epp
Tests a normal behavior while files are updated or downloaded.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-17, 12:35 UTC
by MaxX
2Horst.Epp
Just try yt-dlp downloader or any ffmpeg conversion. TC inititally shows file size 0 until I open the same folder in 7zFM.exe or just press Alt+Enter on the file each time.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-17, 13:04 UTC
by AntonyD
It’s strange that I remember exactly this behavior for a very long time and it seems like I always had to do it -
open the file in Lister without plugins in which the writing is being made and then make sure that its size has increased.

But I agree that having, like, settings to control the update of data in file panels, we are deprived of the opportunity
to see the growth in the size of such files without unnecessary manipulations...

Re: Bug or feature? File size does not refresh

Posted: 2024-02-17, 13:05 UTC
by Dalai
This is a (mis)feature of Windows Vista and higher. XP and older refreshed the file sizes upon directory refresh but newer versions of Windows do that only when a file is opened (and closed again) - which happens when pressing Alt+Enter on a file for example.
See also https://devblogs.microsoft.com/oldnewthing/20111226-00/?p=8813

Due to this annoying behavior I've written a little AutoIt script for myself:

Code: Select all

#NoTrayIcon
#include <WinAPI.au3>

if (NOT $CmdLine[0] >= 1) then Exit(1)

$FileName = $CmdLine[1]

$handle = _WinAPI_CreateFile($FileName, _
                             2, _   ; $iCreation (OPEN_EXISTING)
                             0, _   ; $iAccess (no access required)
                             7 _    ; $iShare (FILE_SHARE_READ or FILE_SHARE_WRITE or FILE_SHARE_DELETE)
                             )
if $handle <> 0 then
    _WinAPI_CloseHandle($handle)
;    MsgBox(0, "", StringFormat('File metadata for "%s" updated.', $FileName))
EndIf
Then I created a new em_ command em_FileMetadataUpdate with parameter %P%N which is launched by pressing Ctrl+Shift+R. So whenever I need live and up-to-date file sizes I set the cursor on the file in question and press Ctrl+Shift+R (followed by the regular Ctrl+R).

Regards
Dalai

Re: Bug or feature? File size does not refresh

Posted: 2024-02-17, 13:11 UTC
by MaxX
I don't know how, but 7zFM gets actual sizes. So, is there any solution to do the same in TC?

Re: Bug or feature? File size does not refresh

Posted: 2024-02-17, 13:25 UTC
by Dalai
Maybe 7zFM opens (all?) the files, thus circumventing this NTFS behavior on newer version of Windows.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-17, 13:35 UTC
by MaxX
Also I can confirm that only NTFS is affected. No problems with FAT32/exFAT there.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-17, 14:03 UTC
by Horst.Epp
It's simply as Dalai and I said :)
The same behavior is explained in Everything forum
and the Author really knows about the Windows file system.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-17, 16:21 UTC
by MaxX
I hope, there is any solution to fix that in TC.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-17, 16:40 UTC
by Dalai
Check in other programs like CMD or Explorer or Explorer++ if they behave the same; they probably do. I'm also quite certain that it's not a bug in TC but a misfeature in Windows as I already mentioned above. I think all that could be done is to somehow circumvent this behavior - most likely at the cost of speed when refreshing.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-17, 19:08 UTC
by MaxX
I think, that it is not a "bug" in TC. WinRAR shows the same.
But it would be great if TC could do the same "magic" as 7zFM does.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-18, 08:16 UTC
by ghisler(Author)
It's as Dalai explains, Windows no longer sends notifications when the size of a file changes, and just reading a directory does not report the new size. Only opening or closing the file causes a refresh. When I need to know the size during a longer download, I quickly press Alt+Enter and ESC.

Theoretically it would be possible to
1. Start a timer when a file is being created or opened
2. In the timer function, open and close that file to update its size
3. Display the updated size.

However, this has several disadvantages:
1. Opening the file can prevent other processes from opening it (sharing violation) with bad timing
2. This only works when in the same directory as the file when it's opened. Getting a list of already open files is tricky
3. It would cause extra system load, especially while downloading a lot of files

So for now I don't plan to add anything like this. I will move this thread to the suggestions forum for further discussion.

Moderator message

Moved to suggestions

Re: Bug or feature? File size does not refresh

Posted: 2024-02-18, 09:59 UTC
by MaxX
May be there could be any simple workaround. Alt+Enter helps to update file size each time you do that, but it is does not autoupdate.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-18, 11:16 UTC
by Dalai
If you need to have up-to-date file sizes (among other metadata) you can use the script I posted above. Compile it to an executable and integrate it into TC any way you like; I posted how I did it above. The same could be done in other programming or scripting languages - just opening and closing a file is enough to force Windows to update the metadata.

Such script could even be expanded to send a refresh command to TC (I've been too lazy to implement that in mine).

Regards
Dalai