czmaster Posted October 28, 2012 Share Posted October 28, 2012 Hello I want to get the folder size while downloading a file (or several files) into this folder. If I use the DirGetSize function, it give me always the same folder size (without the size of the downloading file). If I go into the folder and press F5 , the folder size grow, but I don't want to show the explorer. How to get the real (time) folder size with Autoit ? Thanks Link to comment Share on other sites More sharing options...
rudi Posted October 31, 2012 Share Posted October 31, 2012 Hi. Interesting thing: Even the Explorer is presenting the wrong size, and will show the correct size just at the second, you press <F5>. As soon as you did so, also FileGetSize() and DirGetSize() show the very same value. #include <File.au3> $Folder = _TempFile() DirCreate($Folder) Run("explorer.exe /e,/root," & $Folder) $URL = "http://download.sysinternals.com/files/SysinternalsSuite.zip" $file = $Folder & "\" & StringTrimLeft($URL, (StringInStr($URL, "/", 0, -1))) If FileExists($file) Then FileDelete($file) $Download = InetGet($URL, $file, 1 + 2, 1) $start = TimerInit() Do Sleep(1000) ConsoleWrite(Round(TimerDiff($start) / 1000) & "sec - downloaded: " & InetGetInfo($Download, 0) & ", DirSize: " & DirGetSize($Folder) & ", FileSize: " & FileGetSize($file) & @LF) Until InetGetInfo($Download, 2) ConsoleWrite("Download done. DirSize: " & DirGetSize($Folder) & @LF) So this is basically a Windows issue, and the question is, howto trigger an <F5> for "this folder" using autoit. Who's going to jump in with a solution? Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
JScript Posted October 31, 2012 Share Posted October 31, 2012 I do not think the Windows information is wrong! It reports the value of that file in three ways: Size: 12.5 MB (13,122,601 bytes) Size on disk: 12.5 MB (13,123,584 bytes) And in the Explorer window informs 12.816KB JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
guinness Posted October 31, 2012 Share Posted October 31, 2012 If you want the size on the disk value then look at WinAPIEx and _WinAPI_GetFileSizeOnDisk (though this is for files.) UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
rudi Posted October 31, 2012 Share Posted October 31, 2012 (edited) Hi JS.Who said, the Windows information is WRONG?It's just not up-to-date.Run my example script, and you will notice, that Windows Explorer will ALSO display either 0kB or some other size below the real current size, until <F5> is pressed.As soon as <F5> is pressed, the correct current size is displayed by Windows Explorer, and THEN exatly this size is also measured by FileGetSize() and DirGetSize(). The above is fact for Windows 7 64bit Enterprise and Autoit 3.3.8.1 + SciTE console.For Windows XP SP3, pressing <F5> for Windows Explorer doesn't seem to update the real file size, at least not for that one PC I'm checking this right now at home. And also the SciTE console writes go on reporting 0kB of size, until the download is done. Then WinExplorer and Autoit report the real file size.Regards, Rudi.<edit>Powershell for example is reporting the correct file size also for Windows XP, change to the download dir, then...:Get-ChildItem SysinternalsSuite.zip | ft name,length -autoRegards, Rudi.</edit> Edited October 31, 2012 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now