d4rk Posted February 23, 2008 Share Posted February 23, 2008 2, can i use some codes to find all the .doc file on my pc ? i've tried and success on one or some Dir which was targeted manually [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
BigDod Posted February 23, 2008 Share Posted February 23, 2008 I have no idea who wrote this but it works expandcollapse popup; _FileSearch( <Path and Mask>, <Option (0 - normal, 1- recursive)>) ; Returns array. Either Array of files (full path) where... ; Array[0] is number of files. ; Array[0] = 0 if nothing found. ; ; EXAMPLE USAGE ;-------------------------------------------- $a = _FileSearch("*.au3",1) If $a[0] > 0 Then For $i = 1 to $a[0] MsgBox(4096,"Files Found",$a[$i]) Next EndIf ;-------------------------------------------- Func _FileSearch($szMask,$nOption) $szRoot = "" $hFile = 0 $szBuffer = "" $szReturn = "" $szPathList = "*" Dim $aNULL[1] If Not StringInStr($szMask,"\") Then $szRoot = "c:\" 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) 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) 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 Func _FileSearchUtil(ByRef $ROOT, ByRef $MASK, ByRef $RETURN) $hFile = FileFindFirstFile($ROOT & $MASK) If $hFile >= 0 Then $szBuffer = FileFindNextFile($hFile) While Not @ERROR If $szBuffer <> "." And $szBuffer <> ".." Then _ $RETURN = $RETURN & $ROOT & $szBuffer & "*" $szBuffer = FileFindNextFile($hFile) Wend FileClose($hFile) EndIf EndFunc Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
d4rk Posted February 23, 2008 Author Share Posted February 23, 2008 Thanks, that what i'm looking for also to the author of it [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
d4rk Posted February 23, 2008 Author Share Posted February 23, 2008 2, i need a little help with this useful code ....; _FileSearch( <Path and Mask>, <Option (0 - normal, 1- recursive)>); Returns array. Either Array of files (full path) where...; Array[0] is number of files.; Array[0] = 0 if nothing found.;; EXAMPLE USAGE;--------------------------------------------$a = _FileSearch("*.doc",1)If $a[0] > 0 Then For $i = 1 to $a[0] ;MsgBox(4096,"Files Found",$a[$i]) filedelete($a[$i]) ; when i change to this, the program doesn't delete the .doc file, i don't know but when display in a message box (as the italic line), it show the full path ? NextEndIf;--------------------------------------------Func _FileSearch($szMask,$nOption) $szRoot = "" $hFile = 0 $szBuffer = "" $szReturn = "" $szPathList = "*" Dim $aNULL[1] If Not StringInStr($szMask,"\") Then $szRoot = "c:\" 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) 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) 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),"*") EndIfEndFuncFunc _FileSearchUtil(ByRef $ROOT, ByRef $MASK, ByRef $RETURN) $hFile = FileFindFirstFile($ROOT & $MASK) If $hFile >= 0 Then $szBuffer = FileFindNextFile($hFile) While Not @ERROR If $szBuffer <> "." And $szBuffer <> ".." Then _ $RETURN = $RETURN & $ROOT & $szBuffer & "*" $szBuffer = FileFindNextFile($hFile) Wend FileClose($hFile) EndIfEndFunc [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
MHz Posted February 23, 2008 Share Posted February 23, 2008 I have no idea who wrote this but it worksand many others. I do not recognize this offering.There has been Larry. Ezzetabi, Jos, Gary Frost and some others do a filesearch UDF by memory.Search for "filesearch" will reap results. Link to comment Share on other sites More sharing options...
d4rk Posted February 23, 2008 Author Share Posted February 23, 2008 (edited) these codes can't find *.doc file but it works with *.txt , why ? Edited February 23, 2008 by d4rk [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
BigDod Posted February 23, 2008 Share Posted February 23, 2008 these codes can't find *.doc file but it works with *.txt , why ?It works with .doc for me. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
d4rk Posted February 23, 2008 Author Share Posted February 23, 2008 is it work on all drive ? [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
BigDod Posted February 23, 2008 Share Posted February 23, 2008 is it work on all drive ?If you study the code you will see that it is set to work on c:\. You can change it to work on any drive you choose. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
d4rk Posted February 23, 2008 Author Share Posted February 23, 2008 (edited) If you study the code you will see that it is set to work on c:\. You can change it to work on any drive you choose.Wait a sec ....i change to d:\ where my doc file are store and it works but at first with C:\ when i try a .au3 or txt file, it even find some on E drivemaybe there's a connection between C & E ? Edited February 23, 2008 by d4rk [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
BigDod Posted February 23, 2008 Share Posted February 23, 2008 Try this expandcollapse popup; _FileSearch( <Path and Mask>, <Option (0 - normal, 1- recursive)>) ; Returns array. Either Array of files (full path) where... ; Array[0] is number of files. ; Array[0] = 0 if nothing found. ; ; EXAMPLE USAGE ;-------------------------------------------- $a = _FileSearch("*.doc",1) If $a[0] > 0 Then For $i = 1 to $a[0] MsgBox(4096,"Files Found",'"' & $a[$i] & '"') Next EndIf ;-------------------------------------------- Func _FileSearch($szMask,$nOption) $szRoot = "" $hFile = 0 $szBuffer = "" $szReturn = "" $szPathList = "*" Dim $aNULL[1] If Not StringInStr($szMask,"\") Then $szRoot = "d:\" 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) 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) 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 Func _FileSearchUtil(ByRef $ROOT, ByRef $MASK, ByRef $RETURN) $hFile = FileFindFirstFile($ROOT & $MASK) If $hFile >= 0 Then $szBuffer = FileFindNextFile($hFile) While Not @ERROR If $szBuffer <> "." And $szBuffer <> ".." Then _ $RETURN = $RETURN & $ROOT & $szBuffer & "*" $szBuffer = FileFindNextFile($hFile) Wend FileClose($hFile) EndIf EndFunc Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
BigDod Posted February 23, 2008 Share Posted February 23, 2008 For your filedelete line try thisfiledelete('"' & $a[$i] & '"')Please be sure that you really want to delete the files. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
d4rk Posted February 23, 2008 Author Share Posted February 23, 2008 (edited) your code works , but only in D drive, where my doc file store, i have 1 doc at D & 1 at E, but it can't find doc file in E But thanks for your help, i think it's enough for me, i will handle the other part my self .... thanks again Edited February 23, 2008 by d4rk [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys 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