AndyB Posted January 30, 2006 Share Posted January 30, 2006 Hello. I'm would appreciate it if somebody help me. What i'm going to do: I have some number of directories, i need to check size of this directories and write result to any file, then i need start to calculate size of 1+2+3+....+x directories until I'm received total size max to 4.4 GB (I need this for burn in further this directories on DVD disk), write names of calculated directories to file and start new calculation from next directory etc. I'm started creating AutoIt script (below), i receive sizes of all directories but i don't now how to do calculating ?! Thanks to all. Andy _______________________________________________ #include <Array.au3> $path = "D:\Test" FileChangeDir($path) $search = FileFindFirstFile("*.*") If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $filename = FileFindNextFile($search) If @error Then ExitLoop If StringInStr(FileGetAttrib($filename), "D") Then $outDirName = $filename $outDirSz = DirGetSize($path & "\" & $filename) $outDirSz = Round($outDirSz / 1073741824, 2) If $filename > ".." Then IniWrite("D:\myfile.ini", $outDirName, "Size", $outDirSz) Endif If $filename > ".." Then $var = IniRead("D:\myfile.ini", $outDirName, "Size", "NotFound") Dim $avArray $avArray = _ArrayCreate($var) _ArrayDisplay( $avArray, "Array created with _ArrayCreate" ) Endif EndIf WEnd ________________________________________________________ Link to comment Share on other sites More sharing options...
HardCopy Posted January 30, 2006 Share Posted January 30, 2006 (edited) Just a Quick rehash of your Code ;#include <Array.au3> $path = "c:\downloads" FileChangeDir($path) $search = FileFindFirstFile("*.*") If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf $SzeCount = 0 While 1 $filename = FileFindNextFile($search) If @error Then ExitLoop If StringInStr(FileGetAttrib($filename), "D") Then $outDirName = $filename $outDirSz = DirGetSize($path & "\" & $filename) $SzeCount += $outDirSz If $filename > ".." Then IniWrite("c:\myfile.ini", $outDirName, "Size", Round(($SzeCount / 1024 / 1024),2) & "MB") $SzeCount = 0 $var = IniRead("c:\myfile.ini", $outDirName, "Size", "NotFound") ; Dim $avArray ; $avArray = _ArrayCreate ($var) ; _ArrayDisplay($avArray, "Array created with _ArrayCreate") EndIf EndIf WEnd Hope this gets you on track HardCopy Edited January 30, 2006 by HardCopy Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad Link to comment Share on other sites More sharing options...
AndyB Posted January 30, 2006 Author Share Posted January 30, 2006 Thanks, but i receive an error on line $SzeCount += $outDirSz Error: Expected a "=" operator in assigment statement Andy Link to comment Share on other sites More sharing options...
skippynz Posted January 30, 2006 Share Posted January 30, 2006 Thanks, but i receive an error on line $SzeCount += $outDirSzError: Expected a "=" operator in assigment statementAndytry using the beta version - that script works on beta 3.1.1.105 Link to comment Share on other sites More sharing options...
AndyB Posted January 30, 2006 Author Share Posted January 30, 2006 This is not working Link to comment Share on other sites More sharing options...
skippynz Posted January 30, 2006 Share Posted January 30, 2006 This is not workingare you using scite to edit the scripts - its very useful. allows you to run normal version and beta version, Link to comment Share on other sites More sharing options...
HardCopy Posted January 30, 2006 Share Posted January 30, 2006 Thanks, but i receive an error on line $SzeCount += $outDirSzError: Expected a "=" operator in assigment statementAndyOk if you none beta try$SzeCount = $SzeCount + $outDirSzHardCopy Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad Link to comment Share on other sites More sharing options...
AndyB Posted January 31, 2006 Author Share Posted January 31, 2006 $SzeCount = $SzeCount + $outDirSz working, but calculation is wrong 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