Nirvana6 Posted July 16, 2008 Share Posted July 16, 2008 i searched on the forum but i didn't found something useful for me muttley what can i use to search for multiple file names in computer ? Link to comment Share on other sites More sharing options...
Airwolf Posted July 16, 2008 Share Posted July 16, 2008 FileFindFirstFile/FileFindNextFile and _FileListToArray(). Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
Nirvana6 Posted July 16, 2008 Author Share Posted July 16, 2008 Thanks ! muttley Link to comment Share on other sites More sharing options...
Nirvana6 Posted July 16, 2008 Author Share Posted July 16, 2008 (edited) Another question about searching for files... How do i search in all the subfolders ? P.S : If you coud PM your Yahoo!Messenger ID would be great because i have a series of questions muttley Edited July 17, 2008 by AlexStoian Link to comment Share on other sites More sharing options...
DW1 Posted July 16, 2008 Share Posted July 16, 2008 Hi AlexStoian, These are the two UDF's that I have been using (These are modified copies of some UDFs I found long ago) I modified these, but in no way take credit for their creation: Filesearch1 (Fast, and with filters) expandcollapse popup; _FileSearch( "Path and Mask", <$nOption>, <$cpusaver>, <$dirfilter>, <$filefilter>) ; ;----PARAMETERS----- ;$nOption - <Optional (0 - normal, 1- recursive)> ;$cpusaver - <Optional (0 - normal, 1 - CPU Friendly, but Slower)> ;$dirfilter - <Optional (0 - list directories, 1 - filter out directories)> ;$filefilter- <Optional (0 - list files, 1 - filter out files)> ; ;----RETURN----- ; Returns array. Either Array of files (full path) where... ; Array[0] is number of files. ; Array[0] = 0 if nothing found. ; EXAMPLE USAGE ;-------------------------------------------- ;~ #include<array.au3> ;~ $a = _FileSearch("C:\*.*", 1, 0, 0, 0) ;~ _ArrayDisplay($a) ;-------------------------------------------- Func _FileSearch($szMask, $nOption = 0, $cpusaver = 0, $dirfilter = 0, $filefilter = 0) $szRoot = "" $hFile = 0 $szBuffer = "" $szReturn = "" $szPathList = "*" Dim $aNULL[1] If Not StringInStr($szMask, "\") Then $szRoot = @ScriptDir & "\" Else While StringInStr($szMask, "\") $szRoot = $szRoot & StringLeft($szMask, StringInStr($szMask, "\")) $szMask = StringTrimLeft($szMask, StringInStr($szMask, "\")) WEnd EndIf If $nOption = 0 Then _FileSearchUtil($szRoot, $szMask, $szReturn, $cpusaver, $dirfilter, $filefilter) Else While 1 $hFile = FileFindFirstFile($szRoot & "*.*") If $hFile >= 0 Then $szBuffer = FileFindNextFile($hFile) While Not @error If $szBuffer <> "." And $szBuffer <> ".." And _ StringInStr(FileGetAttrib($szRoot & $szBuffer), "D") Then _ $szPathList = $szPathList & $szRoot & $szBuffer & "*" $szBuffer = FileFindNextFile($hFile) WEnd FileClose($hFile) EndIf _FileSearchUtil($szRoot, $szMask, $szReturn, $cpusaver, $dirfilter, $filefilter) If $szPathList == "*" Then ExitLoop $szPathList = StringTrimLeft($szPathList, 1) $szRoot = StringLeft($szPathList, StringInStr($szPathList, "*") - 1) & "\" $szPathList = StringTrimLeft($szPathList, StringInStr($szPathList, "*") - 1) WEnd EndIf If $szReturn = "" Then $aNULL[0] = 0 Return $aNULL Else Return StringSplit(StringTrimRight($szReturn, 1), "*") EndIf EndFunc ;==>_FileSearch Func _FileSearchUtil(ByRef $ROOT, ByRef $MASK, ByRef $RETURN, $cpusaver, $dirfilter, $filefilter) $hFile = FileFindFirstFile($ROOT & $MASK) If $hFile >= 0 Then $szBuffer = FileFindNextFile($hFile) While Not @error If $cpusaver = 1 Then Sleep(1) ;OPTIONAL FOR CPU SAKE If $szBuffer <> "." And $szBuffer <> ".." Then If StringInStr(FileGetAttrib($ROOT & $szBuffer), "D") Then If $dirfilter = 0 Then $RETURN = $RETURN & $ROOT & $szBuffer & "*" Else If $filefilter = 0 Then $RETURN = $RETURN & $ROOT & $szBuffer & "*" EndIf EndIf $szBuffer = FileFindNextFile($hFile) WEnd FileClose($hFile) EndIf EndFunc ;==>_FileSearchUtiloÝ÷ ØX¥y'ÈvX¶W¬®j+{÷b}÷«z{h¦Ø¨Æ®¶sc²ôfÆU6V&6gV÷C¶F&V7F÷'&ö÷BgV÷C²ÂgV÷C´Ö6²gV÷C²Âb33c¶äfÆrÂò£²b33c¶äfÆrÒÒfÆVæÖW2æBföÆFW&æÖW2&V7W'6fRæòG&fW2÷"F2Æ7FVB£²b33c¶äfÆrÒ"ÒfÇC´G&fRfwC³¢fÇC´föÆFW$æÖRfwC²æöâ&V7W'6fR£²b33c¶äfÆrÒ2ÒfÇC´G&fRfwC³¢fÇC´fÆTæÖRfwC²&V7W'6fRæòföÆFW'2Æ7FVB£²b33c¶äfÆrÒBÒ§W7BföÆFW&æÖW2æöâ&V7W'6fR£²b33c¶äfÆrÒRÒÇ&WF6ÂÆ7Böbb33c¶äfÆrÒb33c¶'&³ÒÖæ÷BöÆBFRæFW2bFW&R&RæöâÇV&WF6Â7F'Fær6&7FW'2£²b33c¶äfÆrÒbÒÇ&WF6ÂÆ7Böbb33c¶äfÆrÒ"b33c¶'&³ÒÖæ÷BöÆBFRæFW2bFW&R&RæöâÇV&WF6Â7F'Fær6&7FW'2£²b33c¶äfÆrÒrÒÆ7FVB2ÂföÆFW"ÂFVâfÆW2âFBföÆFW"ÂæWBföÆFW"Â6öçFVçG2âFBföÆFW"ÂWF2âFöW2æ÷BF7ÆgVÆÂF2£²UÕÄS £·â6æ6ÇVFRfÇC¶'&æS2fwC°£·âb33c¶'&ÒôfÆU6V&6gV÷C´¢b3#²gV÷C²ÂgV÷C²¢â¢gV÷C²Âr£·âô'&F7Æb33c¶'&£²TäBUÕÄP¤gVæ2ôfÆU6V&6b33c·7¥&ö÷BÂb33cµ7¦Ö6²ÒgV÷C²¢â¢gV÷C²Âb33c¶äfÆrÒrÂb33c¶äö62Ò¢Æö6Âb33c¶'&Òb33cµ7¦Ö6²Âb33c¶&V2Âb33c¶FÂb33c¶6÷'@¢7vF6b33c¶äfÆp¢66R¢b33c¶&V2Ò¢b33c¶FÒ¢b33c¶6÷'BÒ¢66R ¢b33c¶&V2Ò¢b33c¶FÒ¢b33c¶6÷'BÒ¢66R0¢b33c¶&V2Ò¢b33c¶FÒ¢b33c¶6÷'BÒ¢66R@¢b33c¶&V2Ò¢b33c¶FÒ¢b33c¶6÷'BÒ¢66RP¢b33c¶&V2Ò¢b33c¶FÒ¢b33c¶6÷'BÒ¢66R`¢b33c¶&V2Ò¢b33c¶FÒ¢b33c¶6÷'BÒ¢66RVÇ6P¢b33c¶&V2Ò¢b33c¶FÒ¢b33c¶6÷'BÒ¢VæE7vF6¢bäõB4'&b33c¶'&FVâb33c¶'&Ò7G&æu7ÆBb33c¶'&Âb33·Âb33²¢¢Æö6Âb33c´fÆRÒÂb33c´eôÆ7BÒb33²b33°¢b33c·7¤'VffW"ÒgV÷C²gV÷C°¢b33c·7¥&WGW&âÒgV÷C²gV÷C°¢b33c·7¥FÆ7BÒgV÷C²¢gV÷C°¢f÷"b33c´ÒFòV&÷VæBb33c¶'&Ó¢b33c·7¤Ö6²Òb33c¶'&²b33c´Ð¢bäõB7G&ætå7G"b33cµ7¦Ö6²ÂgV÷C²b3#²gV÷C²FVà¢b33c·7¥&ö÷Bf׳Òb33²b33°¢VÇ6P¢¢b33c¶G&ÒÒ7G&ætå7G"b33cµ7¦Ö6²ÂgV÷C²b3#²gV÷C²ÃÂÓ¢b33c·7¥&ö÷Bf׳Ò7G&ætÆVgBb33cµ7¦Ö6²Âb33c¶G&Ò¢b33cµ7¦Ö6²Ò7G&æuG&ÔÆVgBb33cµ7¦Ö6²Âb33c¶G&Ò¢¢VæD`¢bb33c¶&V2ÒFVà¢b33c´fÆRÒfÆTfæDf'7DfÆRb33c·7¥&ö÷Bfײb33c·7¤Ö6²¢bb33c´fÆRfwC³ÒFVà¢b33c·7¤'VffW"ÒfÆTfæDæWDfÆRb33c´fÆR¢¢vÆRäõBW'&÷ ¢bb33c¶FÒFVâb33c·7¥&WGW&âf׳Òb33c·7¥&ö÷@¢bb33c·7¤'VffW"fÇC²fwC²gV÷C²âgV÷C²äBb33c·7¤'VffW"fÇC²fwC²gV÷C²ââgV÷C²FVâb33c·7¥&WGW&âf׳Òb33c·7¤'VffW"fײgV÷C²¢gV÷C°¢b33c·7¤'VffW"ÒfÆTfæDæWDfÆRb33c´fÆR¢vVæ@¢¢fÆT6Æ÷6Rb33c´fÆR¢VæD`¢VÇ6P¢¢vÆR¢b33c´fÆRÒfÆTfæDf'7DfÆRb33c·7¥&ö÷BfײgV÷C²¢â¢gV÷C²¢bb33c´fÆRfwC³ÒFVà¢b33c·7¤'VffW"ÒfÆTfæDæWDfÆRb33c´fÆR¢¢vÆRäõBW'&÷ ¢bb33c·7¤'VffW"fÇC²fwC²gV÷C²âgV÷C²äBb33c·7¤'VffW"fÇC²fwC²gV÷C²ââgV÷C²äB7G&ætå7G"fÆTvWDGG&"b33c·7¥&ö÷Bfײb33c·7¤'VffW"ÂgV÷C´BgV÷C²FVâð¢b33c·7¥FÆ7Bf׳Òb33c·7¥&ö÷Bfײb33c·7¤'VffW"fײgV÷C²¢gV÷C°¢b33c·7¤'VffW"ÒfÆTfæDæWDfÆRb33c´fÆR¢vVæ@¢¢fÆT6Æ÷6Rb33c´fÆR¢VæD`¢b7G&ætå7G"b33c·7¥&WGW&âÂb33cµ7¦Ö6²fwC²äBb33c¶äö62ÒFVà¢b33c·7¥&ö÷BÒb33²b33°¢WDÆö÷¢VæD`¢b33c´fÆRÒfÆTfæDf'7DfÆRb33c·7¥&ö÷Bfײb33c·7¤Ö6²¢bb33c´fÆRfwC³ÒFVà¢b33c·7¤'VffW"ÒfÆTfæDæWDfÆRb33c´fÆR¢¢vÆRäõBW'&÷ ¢bb33c¶FÒFVâb33c·7¥&WGW&âf׳Òb33c·7¥&ö÷@¢bb33c·7¤'VffW"fÇC²fwC²gV÷C²âgV÷C²äBb33c·7¤'VffW"fÇC²fwC²gV÷C²ââgV÷C²FVâb33c·7¥&WGW&âf׳Òb33c·7¤'VffW"fײgV÷C²¢gV÷C°¢b33c·7¤'VffW"ÒfÆTfæDæWDfÆRb33c´fÆR¢vVæ@¢¢fÆT6Æ÷6Rb33c´fÆR¢VæD`¢bb33c·7¥FÆ7BÓÒgV÷C²¢gV÷C²FVâWDÆö÷¢b33c·7¥FÆ7BÒ7G&æuG&ÔÆVgBb33c·7¥FÆ7B¢b33c·7¥&ö÷BÒ7G&ætÆVgBb33c·7¥FÆ7BÂ7G&ætå7G"b33c·7¥FÆ7BÂgV÷C²¢gV÷C²ÒfײgV÷C²b3#²gV÷C°¢b33c·7¥FÆ7BÒ7G&æuG&ÔÆVgBb33c·7¥FÆ7BÂ7G&ætå7G"b33c·7¥FÆ7BÂgV÷C²¢gV÷C²Ò¢vVæ@¢¢VæD`¢æW@¢bb33c·7¥&WGW&âÒgV÷C²gV÷C²FVà¢&WGW&â¢VÇ6P£·âb33c·7¥&WGW&âÒ7G&æu&WÆ6Rb33c·7¥&WGW&âÂb33²b3#²b33²Âb33²b33²¢b33c´eôÆ7BÒ7G&æu7ÆB7G&æuG&Õ&vBb33c·7¥&WGW&âÂÂgV÷C²¢gV÷C²¢bb33c¶6÷'BÒFVâô'&6÷'Bb33c´eôÆ7B¢&WGW&âb33c´eôÆ7@¢VæD`¤VæDgVæ2²fÇC³ÓÓÒfwC²ôfÆU6V&6 AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Nirvana6 Posted July 16, 2008 Author Share Posted July 16, 2008 (edited) Thanks ! muttley Now..For the second UDF ... What i must add to the code to run ? Edited July 16, 2008 by AlexStoian 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