speedy6 Posted February 6, 2008 Share Posted February 6, 2008 Hi, i'm using _FileListToArray3 But i've a problem with it. When i use this: local $path = "c:\",$filter = "*.exe",$sExclude="c:\Windows\*|Backup|MSOCache" $ar_Array = _FileListToArray3 ($path, $filter, 0, 1, 1,$sExclude) _ArrayDisplay($ar_Array, "File List") I stil get files within the c:\windows folder, but I excuded them...how can I solve that? Link to comment Share on other sites More sharing options...
Zedna Posted February 6, 2008 Share Posted February 6, 2008 I don't know exact answer because I don't have this UDF but try: $sExclude="c:\Windows\|Backup|MSOCache" Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
randallc Posted February 6, 2008 Share Posted February 6, 2008 (edited) Hi, My memory is that Exclude works on folder names only if the flag is for a recursive list of folders, I fear; not sure if i can change that easily, or want to? [and I have to go back and check if it is true] [Whether I'm right or not, ] Workaround, I'm afraid [-not- tested just now] is to do 2 stages; 1. Call the function with flag set to "2", to get recursive list of the folders. $sPath1 = "c:\", $filter = "*" , $Exclude = "windows|backup|MSOCache"oÝ÷ Ûe,zØZµªëk(§jZ(¦ÚjY_ºw-ðØ_¨,zÚ®¢Ýjº_¢·âë(¢æú.×bç-¢¼§¢zÞrêì÷¥É«¢+ØÀÌØíÍAÑ ÄômÉÉå%ѵt°ÀÌØí¥±ÑÈôÅÕ½Ð쨹áÅÕ½Ðì°ÀÌØíá±ÕôÅÕ½ÐìÅսРProbably no slower, as recursive component only used once. Best, Randall Edited February 6, 2008 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
speedy6 Posted February 7, 2008 Author Share Posted February 7, 2008 Like this?: local $path = "c:\",$filter = "*.exe",$sExclude="Windows|Backup|MSOCache" $ar_Array = _FileListToArray3 ($path, $filter, 2, 1, 1,$sExclude) $ar_Array2 = _FileListToArray3 ($ar_Array, $filter, 1, 1, 1,"") _ArrayDisplay($ar_Array2, "File List") That give's me nothing, he doesn't find a thing... Link to comment Share on other sites More sharing options...
randallc Posted February 8, 2008 Share Posted February 8, 2008 (edited) Like this?: local $path = "c:\",$filter = "*.exe",$sExclude="Windows|Backup|MSOCache" $ar_Array = _FileListToArray3 ($path, $filter, 2, 1, 1,$sExclude) $ar_Array2 = _FileListToArray3 ($ar_Array, $filter, 1, 1, 1,"") _ArrayDisplay($ar_Array2, "File List") That give's me nothing, he doesn't find a thing...Hi, No, there won't be any directories returned if you have your folder filter with "*.exe" rather than "*" then you will need to do aloop on that array and save data from each array. I can make it easier with this modification, so a string is returned each time; #include-once ;~ #include"_ArrayDisplaySortV.au3" ;~ #include "ArrayDupes8.au3" #include<FileListToArray3.au3> #include<Array.au3> Local $sArray2,$ar_Array = _FileListToArray3("c:\", "*", 2, 1, 1, "windows|backup|MSOCache"); $Flag = 2, $Recurse = 1, $BasDir = 1;,$sPath1 = @ScriptDir ;~ _ArrayDisplay($ar_Array,"$ar_Array Folders") For $i = 1 To UBound($ar_Array) - 1 $sArray2 &= _FileListToArray3($ar_Array[$i], "*.exe", 1, 0, 1, "", 2);$Flag = 1, $Recurse = 0, $BasDir = 1, $sExclude = "" Next $ar_Array = StringSplit(StringTrimRight($sArray2,1), "*", 1) _ArrayDisplay($ar_Array,"$ar_Array Files")Best, randall Edited February 11, 2008 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
speedy6 Posted February 8, 2008 Author Share Posted February 8, 2008 Hi, No, there won't be any directories returned if you have your folder filter with "*.exe" rather than "*" then you will need to do aloop on that array and save data from each array. I can make it easier with this modification, so a string is returned each time; #include-once ;~ #include"_ArrayDisplaySortV.au3" ;~ #include "ArrayDupes8.au3" #include<FileListToArray3.au3> #include<Array.au3> Local $sArray2,$ar_Array = _FileListToArray3("c:\", "*", 2, 1, 1, "windows|backup|MSOCache"); $Flag = 2, $Recurse = 1, $BasDir = 1;,$sPath1 = @ScriptDir ;~ _ArrayDisplay($ar_Array,"$ar_Array Folders") For $i = 1 To UBound($ar_Array) - 1 $sArray2 &= _FileListToArray3($ar_Array[$i], "*.exe", 1, 0, 1, "", 2);$Flag = 1, $Recurse = 0, $BasDir = 1, $sExclude = "" Next $ar_Array = StringSplit(StringTrimRight($sArray2,1), "*", 1) _ArrayDisplay($ar_Array,"$ar_Array Files")Best, randall $sArray2 &= _FileListToArray3($ar_Array[$i], "*.exe", 1, 0, 1, "", 2); Get error on that, isn't it: $sArray2 &= _FileListToArray3($ar_Array[$i], "*.exe", 1, 0, 1, ""); But even with that I get an empty array... Link to comment Share on other sites More sharing options...
randallc Posted February 8, 2008 Share Posted February 8, 2008 I can make it easier with this modification, so a string is returned each time;Best, randallHi,I don't think you have used the modified file I posted in the zip in that post; that is why the "2" is there... The new version then returns a string, otherwise you are trying to add arrays..Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
speedy6 Posted February 8, 2008 Author Share Posted February 8, 2008 jah you where wright. But still an empty array. #include-once #include<FileListToArray3.au3> ;#include<_FileListToArrayNew2h.au3> #include<Array.au3> Local $sArray2,$ar_Array = _FileListToArray("c:\", "*", 2, 1, 1, "windows|backup|MSOCache"); $Flag = 2, $Recurse = 1, $BasDir = 1;,$sPath1 = @ScriptDir ;~ _ArrayDisplay($ar_Array,"$ar_Array Folders") For $i = 1 To UBound($ar_Array) - 1 $sArray2 &= _FileListToArray($ar_Array[$i], "*.exe", 1, 0, 1, "", 2);$Flag = 1, $Recurse = 0, $BasDir = 1, $sExclude = "" Next $ar_Array = StringSplit(StringTrimRight($sArray2,1), "*", 1) _ArrayDisplay($ar_Array,"$ar_Array Files") Link to comment Share on other sites More sharing options...
randallc Posted February 8, 2008 Share Posted February 8, 2008 jah you where wright. But still an empty array. #include-once #include<FileListToArray3.au3> ;#include<_FileListToArrayNew2h.au3> #include<Array.au3> Local $sArray2,$ar_Array = _FileListToArray("c:\", "*", 2, 1, 1, "windows|backup|MSOCache"); $Flag = 2, $Recurse = 1, $BasDir = 1;,$sPath1 = @ScriptDir ;~ _ArrayDisplay($ar_Array,"$ar_Array Folders") For $i = 1 To UBound($ar_Array) - 1 $sArray2 &= _FileListToArray($ar_Array[$i], "*.exe", 1, 0, 1, "", 2);$Flag = 1, $Recurse = 0, $BasDir = 1, $sExclude = "" Next $ar_Array = StringSplit(StringTrimRight($sArray2,1), "*", 1) _ArrayDisplay($ar_Array,"$ar_Array Files")Hi, I don't understand what you are doing here; where did "_FileListToArray" come from?, instead of "_FileListToArray3"; do you know you can just copy the script from the screen in the forum?? Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
speedy6 Posted February 10, 2008 Author Share Posted February 10, 2008 (edited) Yeah I did that. But then I get the error can't find function _filelisttoarray3 with this: #include-once #include<FileListToArray.au3> #include<Array.au3> Local $sArray2,$ar_Array = _FileListToArray3("c:\", "*", 2, 1, 1, "windows|backup|MSOCache"); $Flag = 2, $Recurse = 1, $BasDir = 1;,$sPath1 = @ScriptDir ;~ _ArrayDisplay($ar_Array,"$ar_Array Folders") For $i = 1 To UBound($ar_Array) - 1 $sArray2 &= _FileListToArray3($ar_Array[$i], "*.exe", 1, 0, 1, "", 2);$Flag = 1, $Recurse = 0, $BasDir = 1, $sExclude = "" Next $ar_Array = StringSplit(StringTrimRight($sArray2,1), "*", 1) _ArrayDisplay($ar_Array,"$ar_Array Files") Edited February 10, 2008 by speedy6 Link to comment Share on other sites More sharing options...
randallc Posted February 10, 2008 Share Posted February 10, 2008 Yeah I did that.But then I get the error can't find function _filelisttoarray3#include<FileListToArray.au3>Hi,So again, you have not included the correct last UDF!Copy the script from post#5; It has "#include<FileListToArray3.au3>" not "#include<FileListToArray.au3>"Do you understand you can copy the script from the screen in the forums, so you don't have to re-write it with mistakes...?Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
speedy6 Posted February 11, 2008 Author Share Posted February 11, 2008 Yeah sure I understand. But with that post and that download you got error's. In the ZIP file with that post from you, the file is: FileListToArray.au3 And the code that you write is: #include<FileListToArray3.au3> So? Link to comment Share on other sites More sharing options...
randallc Posted February 11, 2008 Share Posted February 11, 2008 (edited) Yeah sure I understand. But with that post and that download you got error's. In the ZIP file with that post from you, the file is: FileListToArray.au3 And the code that you write is: #include<FileListToArray3.au3> So?Hi, I see! I uploaded the "FilelistToArray3" to the thread at the link in my signature; sorry if I confused you.. Best, randall [PS I hope that's the correct one! - if not, send me a pm as I am runing out of Kb for attachments...] Edited February 11, 2008 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
speedy6 Posted February 11, 2008 Author Share Posted February 11, 2008 Aah, thx I though I was stupid or so I can run it again. But still the folder Windows is in the list. (see screenshot) Link to comment Share on other sites More sharing options...
randallc Posted February 11, 2008 Share Posted February 11, 2008 (edited) Aah, thx I though I was stupid or so I can run it again. But still the folder Windows is in the list. (see screenshot)Hi, no your screen shot shows "Windows\system32" folders , not "Windows" folder. if you want to get rid of all folders with Windows as base directory, you'll need to loop through the array of folders first and delete them Good point, though, and I may add "no subfolders below excluded folder" as an option later. Best, randallWoops, wrong again! I'll look Randall OK ; very sorry again; fixed the RegExp in my UDF; not sure how I ever tested it as accurate. [in my UDF; line about 69 If $sExclude <> "" Then $sExclude = "(?i)(" & StringReplace(StringReplace(StringReplace($sExclude, ".", "\."), "*", ".*"), "?", ".") & ")" ;change the filters to RegExp filters] Thanks for pointing it out Best, Randall Edited February 11, 2008 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
speedy6 Posted February 11, 2008 Author Share Posted February 11, 2008 Perfect Thankx 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