Page 2 of 2

Re: Bug or feature? File size does not refresh

Posted: 2024-02-18, 12:25 UTC
by MaxX
2Dalai
I don't have enough skills in such scripting, sorry. That way is not available for me now. It would be easier just to open 7zFM in background.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-18, 13:18 UTC
by Dalai
  1. Save the code I posted into an AutoIt script file; I named mind FileMetadataUpdate.au3.
  2. Download AutoIt - I recommend the ZIP - and extract it to a directory of your choice.
  3. Start Aut2Exe.exe, point it to the script you saved previously and click "Convert". This will compile the script into an executable in the same directory as the script.
  4. Incorporate the compiled script into TC just like any other program (button, TC start menu, em_ command etc). It expects a single parameter which is the full path to the file in question, i.e. %P%N in TC.
Regards
Dalai

Re: Bug or feature? File size does not refresh

Posted: 2024-02-19, 06:46 UTC
by AntonyD
2Dalai
But more often we need to watch for multiple files. Like, I don't know - like when virus is "eating" in a real-time files - encrypting them totally...
In this case of course watching tool for only ONE file - is not enough. And again - 7zFM could do that! So why not to check its code and incorporate it's best moments into Total?

Re: Bug or feature? File size does not refresh

Posted: 2024-02-19, 09:27 UTC
by ghisler(Author)
I have tested 7zFM, but the displayed file size did not change until the download finished (I used Firefox to download a big file).

Re: Bug or feature? File size does not refresh

Posted: 2024-02-19, 11:43 UTC
by Dalai
2AntonyD
It's certainly possible to change the script in a way that all files in a directory are opened and closed. But I don't think this is a good idea when dealing with large directories and/or anti-virus software because then it definitely cost performance.

2ghisler(Author)
For me it works. I downloaded a Windows 10 ISO from Microsoft (with browser's user agent set to WinXP so that the page doesn't redirect to the crappy Media Creation Tool instead), opened 7zFM and changed to the directory where Firefox saved the download. 7zFM updated the directory list in regular intervals, maybe once a second. As long as 7zFM was open, TC got the new file size, too. Once 7zFM was closed, the updates stopped. Note that 7zFM has a setting in menu View > Auto Refresh that controls whether or not the directory list is updated automatically. Since the 7-Zip source code is available it should be easy to figure out how it does that.

Regards
Dalai

Re: Bug or feature? File size does not refresh

Posted: 2024-02-19, 15:23 UTC
by MaxX
2ghisler(Author)
Just leave 7zFM opened in background (but don't minimize it).

Here is how that looks:
https://i.imgur.com/MeuaE1z.gif

I use dx.bat as an example:

Code: Select all

@curl.exe -RLO "https://download.microsoft.com/download/8/4/A/84A35BF1-DAFE-4AE8-82AF-AD2AE20B6B14/directx_Jun2010_redist.exe"
You may use any other download tool, archive packer, video converter/editor. There's no diffrence. We need only NTFS and unknown target file size, as I see.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-19, 15:38 UTC
by MaxX
I hope, that there exist any workaround to make this work.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-20, 08:44 UTC
by ghisler(Author)
That's odd, I left 7zFM open in the background during the download, but it did not update. I also switched to 7zFM during another download, and the filze size didn't change until the download was complete. This was with 7zip 23.01 on Windows 11 pro.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-20, 11:13 UTC
by Dalai
2ghisler(Author)
Did you enable View > Auto Refresh in 7zFM (which I mentioned above)?

Re: Bug or feature? File size does not refresh

Posted: 2024-02-21, 07:40 UTC
by ghisler(Author)
Yes, View - Auto Refresh is checked. Otherwise it wouldn't have updated once the transfer was done.

How often does it refresh? My download was 10 seconds, so if it only happens every half a minute or so, I wouldn't see any refresh.

Re: Bug or feature? File size does not refresh

Posted: 2024-02-21, 11:09 UTC
by Dalai
In my case it refreshed about once a second (or every two seconds). Maybe it depends on the Windows version or program used to download a file. Try downloading a file with wget, curl (shipped with Windows 10 1803 and higher) or aria2 (with switch --file-allocation=none so it doesn't preallocate the full file size).

Regards
Dalai

Re: Bug or feature? File size does not refresh

Posted: 2024-02-27, 21:19 UTC
by Mjolnir
2AntonyD
Dalai is right on large folders... nevertheless, here a folder parsing version of his script
Just run the scrip with "%P" as parameter (don't forget the 2x " )

Code: Select all

#NoTrayIcon
#include <File.au3>
#include <WinAPI.au3>
$Debug = 0

If (Not $CmdLine[0] >= 1) Then _Exit(2,"No path given on command line (try " & '"%P"' & ")")
$localFolder = $CmdLine[1]

$aFileList = _FileListToArray($localFolder, Default, Default, True)
If @error = 1 Then _Exit(1,"Invalid path: " & $localFolder)
If @error = 4 Then _Exit(4,"No file(s) were found in: " & $localFolder)

For $idf = 1 To $aFileList[0]
	$hidf = _WinAPI_CreateFile($aFileList[$idf],2,0,7)
	If $hidf <> 0 Then _WinAPI_CloseHandle($hidf)
	If $Debug Then MsgBox(0,@ScriptName,$idf & " / " & $aFileList[0] & @CR & "File metadata updated for: " & $aFileList[$idf] & @CR & FileGetSize($aFileList[$idf]) & " bytes")
Next
If $Debug Then _Exit(0,"Processed: " & $aFileList[0] & " file(s)")

Func _Exit($id = 0, $tkn = "")
	MsgBox(0,@ScriptName,"Exit (" & $id & ")" & @CR & $tkn)
	Exit($id)
EndFunc