lewwy Posted December 1, 2009 Posted December 1, 2009 Hi All, I'm trying to make a script up for work, basically its function is to backup certain directories from a PC. I'm hitting a brick wall where I've used the FileFindFirstFile and FileFindNextFile functions respectively, and I can pull an entire list of all the files on the root of c:, yet if I do something like this... While 1 == 1 $Counter = $Counter + 1 $AdvancedCFiles[$Counter] = FileFindNextFile($FilesToFind) If @error Then ExitLoop If Not $AdvancedCFiles[$Counter] = "Windows" OR "Program Files" OR "Documents and Settings" Then $AdvancedCFilesSize[$Counter] = Round(DirGetSize("c:\" & $AdvancedCFiles[$Counter]) / 1024 / 1024 ) $AdvancedCFilesSize[$Counter] = $AdvancedCFilesSize[$Counter] & " MB" $AdvancedCFilesModified[$Counter] = FileGetTime("c:\" & $AdvancedCFiles[$Counter]) GUICtrlCreateListViewItem($AdvancedCFiles[$Counter] & "|" & $AdvancedCFilesSize[$Counter] & "|" & $AdvancedCFilesModified[$Counter], $Treeview1) EndIf $Counter = $Counter + 1 WEnd Then it won't pull the directory listing at all. I've got no idea with this one....any ideas anyone?
martin Posted December 1, 2009 Posted December 1, 2009 Hi All, I'm trying to make a script up for work, basically its function is to backup certain directories from a PC. I'm hitting a brick wall where I've used the FileFindFirstFile and FileFindNextFile functions respectively, and I can pull an entire list of all the files on the root of c:, yet if I do something like this... While 1 == 1 $Counter = $Counter + 1 $AdvancedCFiles[$Counter] = FileFindNextFile($FilesToFind) If @error Then ExitLoop If Not $AdvancedCFiles[$Counter] = "Windows" OR "Program Files" OR "Documents and Settings" Then $AdvancedCFilesSize[$Counter] = Round(DirGetSize("c:\" & $AdvancedCFiles[$Counter]) / 1024 / 1024 ) $AdvancedCFilesSize[$Counter] = $AdvancedCFilesSize[$Counter] & " MB" $AdvancedCFilesModified[$Counter] = FileGetTime("c:\" & $AdvancedCFiles[$Counter]) GUICtrlCreateListViewItem($AdvancedCFiles[$Counter] & "|" & $AdvancedCFilesSize[$Counter] & "|" & $AdvancedCFilesModified[$Counter], $Treeview1) EndIf $Counter = $Counter + 1 WEnd Then it won't pull the directory listing at all. I've got no idea with this one....any ideas anyone? Mhh. Maybe this is the sort of thing you want, but you need to do some homework FileChangeDir("\");set the drive maybe? $FilesToFind = FileFindFirstFile("*.*") $counter = 0 ;ConsoleWrite(@WorkingDir & @CRLF) Dim $AdvancedCFilesModified[5], $AdvancedCFiles[5], $AdvancedCFilesSize[5], $AdvancedCFilesModified[5] While 1 $res = FileFindNextFile($FilesToFind) If @error Then ExitLoop If stringinstr(FileGetAttrib($res),'D') Then ;if it's a folder If $res <> @WindowsDir And $res <> @ProgramFilesDir And $res <> @MyDocumentsDir And $res <> @DocumentsCommonDir Then ;make sure array i sbig enough to add another result If UBound($AdvancedCFilesModified) < $counter + 1 Then ReDim $AdvancedCFilesModified[$counter + 2] ReDim $AdvancedCFilesSize[$counter + 2] ReDim $AdvancedCFilesModified[$counter + 2] ReDim $AdvancedCFiles[$counter + 2] EndIf $AdvancedCFiles[$counter] = $res $AdvancedCFilesSize[$counter] = Round(DirGetSize("c:\" & $AdvancedCFiles[$counter]) / 1024 / 1024) $AdvancedCFilesSize[$counter] = $AdvancedCFilesSize[$counter] & " MB" $AdvancedCFilesModified[$counter] = FileGetTime("c:\" & $AdvancedCFiles[$counter]) ;for you to use ;GUICtrlCreateListViewItem($AdvancedCFiles[$Counter] & "|" & $AdvancedCFilesSize[$Counter] & "|" & $AdvancedCFilesModified[$Counter], $Treeview1) ;for me to test ConsoleWrite($AdvancedCFiles[$counter] & "|" & $AdvancedCFilesSize[$counter] & "|" & $AdvancedCFilesModified[$counter] & @CRLF) $counter = $counter + 1 EndIf EndIf WEnd Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
lewwy Posted December 1, 2009 Author Posted December 1, 2009 Mhh. Maybe this is the sort of thing you want, but you need to do some homework ..code..Hey man, just letting you know I did the whole filefindfirstfile outside of that bit of code, so that wasnt the problem. That chunk was hastily copy pasted yesterday when I was sick of the program, lol. I'll give your suggestion a go though.
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