New topic: 

[SOLVED] What is the Best way to perform a file search ?

<http://forums.realsoftware.com/viewtopic.php?t=43323>

         Page 1 of 1
   [ 8 posts ]                 Previous topic | Next topic          Author  
Message        Nevercom          Post subject: [SOLVED] What is the Best way to 
perform a file search ?Posted: Sat Mar 24, 2012 10:08 pm                        
 
Joined: Sun Jul 31, 2011 11:30 pm
Posts: 15                Hi

I want to perform a search for an specific file type (lets say .exe) including 
subfolders on windows platform
What is the best way, actually the fastest way to do that ?

i know i can access to Number of files within a folder using FolderItem.Count 
Property and then get all files with .exe extension, but i guess that this way, 
subfolders are not included.

and i aware of "DIR" Command-Line Switch for Windows cmd
Code:DIR "C:\*.exe" /A:-D /B /O:N /s

i'm wondering if there is a way to search all subfolders within a Directory, 
using RB built-in functions...


so what is the Fastest and better way to it ? (i just want it to work on 
Windows OS)

Thanks     

    Last edited by Nevercom on Sun Mar 25, 2012 3:03 pm, edited 1 time in 
total.   
                             Top                 charonn0          Post 
subject: Re: What is the Best way to perform a file search ?Posted: Sat Mar 24, 
2012 11:10 pm                                 
Joined: Mon Apr 02, 2007 2:08 am
Posts: 705
Location: San Francisco, CA, USA                The File Enumerator section the 
the RB Curriculum covers this in depth.      
_________________
Boredom Software  
                             Top                Nevercom          Post subject: 
Re: What is the Best way to perform a file search ?Posted: Sat Mar 24, 2012 
11:59 pm                         
Joined: Sun Jul 31, 2011 11:30 pm
Posts: 15                Thanks, That was really helpful

Actually it came across my mind to use a Recursive method to search all 
subfolders, then i was trying to figure out how to do this in a thread ?

how to make this FileEnumerator run in a thread ?   
                             Top                 timhare          Post subject: 
Re: What is the Best way to perform a file search ?Posted: Sun Mar 25, 2012 
12:17 am                         
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 11077
Location: Portland, OR  USA                Just call it from a thread.  
Anything in Thread.Run or called by Thread.Run, runs in the context of the 
thread.  So if you have a pushbutton that calls your method, move that call to 
thread1.run and have the pushbutton call 

thread1.run

Done.  Your code is threaded.   
                             Top                Nevercom          Post subject: 
Re: What is the Best way to perform a file search ?Posted: Sun Mar 25, 2012 
12:24 am                         
Joined: Sun Jul 31, 2011 11:30 pm
Posts: 15                So in this case that the method is calling itself 
repeatedly, is it enough to just do the first call of Method in a Thread ?   
                             Top                 hmasr          Post subject: 
Re: What is the Best way to perform a file search ?Posted: Sun Mar 25, 2012 
4:41 am                         
Joined: Sun Sep 19, 2010 3:05 am
Posts: 25                Yes, but take care not to run the thread again while 
it is running or you will get thread already running exception. You can disable 
the button that runs the thread at the beginning of the thread.run and enable 
it again at the end   
                             Top                 timhare          Post subject: 
Re: What is the Best way to perform a file search ?Posted: Sun Mar 25, 2012 
6:55 pm                         
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 11077
Location: Portland, OR  USA                Nevercom wrote:So in this case that 
the method is calling itself repeatedly, is it enough to just do the first call 
of Method in a Thread ?
Yes, anything that thread.run calls, and anything called by anything that 
thread.run calls, are all run in the thread context.  It makes no difference 
where the code is in your project, it only matters where the call chain 
originated.  You could even call a method defined in another thread subclass, 
and it will be run in the current thread.   
                             Top                Nevercom          Post subject: 
Re: [SOLVED] What is the Best way to perform a file search ?Posted: Sun Mar 25, 
2012 7:20 pm                         
Joined: Sun Jul 31, 2011 11:30 pm
Posts: 15                thank you for your great help and providing such a 
good information 

I think i understand all this much more better 

Thanks in Advance   
                             Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 8 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to