Chimaera Posted February 12, 2011 Share Posted February 12, 2011 Ok i started with this by guinness $FileSize = FileGetSize(@WindowsDir & "\explorer.exe") $ByteSize = _ByteSuffix($FileSize) MsgBox(0, "Example", $ByteSize) Func _ByteSuffix($bs_Bytes, $bs_Places = 2) Local $A, $bs_Array[6] = [" B", " KB", " MB", " GB", " TB", " PB"] While $bs_Bytes > 1023 $A += 1 $bs_Bytes /= 1024 WEnd Return Round($bs_Bytes, $bs_Places) & $bs_Array[$A] EndFunc ;==>_ByteSuffix and i wanted to know the size of a folder so i modified like this $FolderList = "C:\Users" $FolderExclude = DirGetSize("C:\Users\Public" & "C:\Users\Default") ;=============================================================================== $FolderSize = DirGetSize($FolderList) $ByteSize = _ByteSuffix($FolderSize - $FolderExclude) MsgBox(0, "Example", $ByteSize) ;=============================================================================== Func _ByteSuffix($bs_Bytes, $bs_Places = 2) Local $A, $bs_Array[6] = [" B", " KB", " MB", " GB", " TB", " PB"] While $bs_Bytes > 1023 $A += 1 $bs_Bytes /= 1024 WEnd Return Round($bs_Bytes, $bs_Places) & $bs_Array[$A] EndFunc ;==>_ByteSuffix and this amendment i tried as well Local $Folder_Ex $FolderList = "C:\Users" $FolderEx = '"C:\Users\Public" "C:\Users\Default"' $FolderExclude = DirGetSize($Folder_Ex) Looking at the helpfile dosent really cover what i want I am trying to find a way to allow me to add a set of exempt folders which are deducted against the overall figure but, i need to add in a drive selector as most of the time it will be run on a drive which is a secondary drive So if drive becomes F: instead of C: then it needs to search there but i also want to exclude some of the folder with the accounts that will be present the 2 ive listed are easy because they are at the top level I will not know what the user accounts are or what they are called so is there a way to exclude folders like C:\Users\David\Tracing when i am not booting the drive? Edit:,,, just realised that this might work C:\Users\*\Tracing and it would also work presumably for all accounts present so how do i add a series of folders for DirGetSize to add together and deduct from the main folder size?? Many thanks for any help If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted February 12, 2011 Share Posted February 12, 2011 (edited) Does this give you an idea?! Your $FolderExclude doesn't work like that, DirGetSize() can only have 1 path as far as I am aware. So instead I used an Array with no Index Number e.g. NOT $Array[3] = [2, "One", "Two"] Global $FolderList = "C:\Users" Global $ExludeArray[2] = [DirGetSize("C:\Users\Public"), DirGetSize("C:\Users\Default")] ;=============================================================================== Global $FolderSize = DirGetSize($FolderList) Global $Count = 0 For $A = 0 To Ubound($ExludeArray,1) - 1 $Count += $ExludeArray[$A] Next Global $ByteSize = _ByteSuffix($FolderSize - $Count) MsgBox(0, _ByteSuffix($Count), $ByteSize) ;=============================================================================== Func _ByteSuffix($bs_Bytes, $bs_Places = 2) Local $A, $bs_Array[6] = [" B", " KB", " MB", " GB", " TB", " PB"] While $bs_Bytes > 1023 $A += 1 $bs_Bytes /= 1024 WEnd Return Round($bs_Bytes, $bs_Places) & $bs_Array[$A] EndFunc ;==>_ByteSuffix Edited February 12, 2011 by guinness 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...
Chimaera Posted February 12, 2011 Author Share Posted February 12, 2011 Thanks for the help I have added a few extras into the array but it still reports the same amount of GB so im not sure if its correct what i have done, i even tried adding one i knew was 4gb less if deducted but it still returns the same GB Global $FolderList = "C:\Users" Global $ExludeArray[5] = [DirGetSize("C:\Users\Public"), DirGetSize("C:\Users\Default"), DirGetSize("C:\Users\*\Tracing"), DirGetSize("C:\Users\*\Searches"), DirGetSize("C:\Users\*\Links")] ;=============================================================================== Global $FolderSize = DirGetSize($FolderList) Global $Count = 0 For $A = 0 To Ubound($ExludeArray,1) - 1 $Count += $ExludeArray[$A] Next Global $ByteSize = _ByteSuffix($FolderSize - $Count) MsgBox(0, "Amount Of Data Is", $ByteSize) ;=============================================================================== Func _ByteSuffix($bs_Bytes, $bs_Places = 2) Local $A, $bs_Array[6] = [" B", " KB", " MB", " GB", " TB", " PB"] While $bs_Bytes > 1023 $A += 1 $bs_Bytes /= 1024 WEnd Return Round($bs_Bytes, $bs_Places) & $bs_Array[$A] EndFunc ;==>_ByteSuffix If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted February 12, 2011 Share Posted February 12, 2011 (edited) DirGetSize("C:\Users\*\Tracing") Returns -1 so it doesn't work and I kind of knew it you have to specify a Full Path! Plus my Example works, but bare in mind that if the difference is a couple of bytes it won't really show. I would suggest substituting the _ByteSuffix() just for testing purposes! Try this for testing, because it will show more of a difference. Func _ByteSuffix($bs_Bytes, $bs_Places = 2) Local $A = 1, $bs_Array[4] = [3, " B", " KB", " MB"] While $bs_Bytes > 1023 If $A = $bs_Array[0] Then ExitLoop $bs_Bytes /= 1024 $A += 1 WEnd Return Round($bs_Bytes, $bs_Places) & $bs_Array[$A] EndFunc ;==>_ByteSuffix Edited February 12, 2011 by guinness 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...
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