Board index » delphi » File searching all over hard drive

File searching all over hard drive

    What is a easy way of searching for a file in TP 7? I want to be able to
search in all the directories and the root also. Any ideas?

Thanks

Sheldon
P.S. Please E-Mail me your ideas.

 

Re:File searching all over hard drive


Quote
Sheldon Marchand wrote in message <65lh2a$ll...@nr1.toronto.istar.net>...

|
|    What is a easy way of searching for a file in TP 7? I want to be able
to
|search in all the directories and the root also. Any ideas?
|
|
|Thanks
|
|Sheldon
|P.S. Please E-Mail me your ideas.
|
|

You need a recursive procedure to search all the directory. I've done this
to do a prog. that do like dir /s but with the acurate total (not like dir
who don't count hiden file). Unfortunatly I deleted the source! But I can
tell you that it's quite easy to do!

Re:File searching all over hard drive


Quote
Sheldon Marchand (march...@execulink.com) wrote:

:     What is a easy way of searching for a file in TP 7? I want to be able to
: search in all the directories and the root also. Any ideas?

There are two instrucions in TP: FindFirst and FindNext. Just type any of
these in your source and press CTRL-F1 for detailed informations.

regards,
Michal Urbanczyk
(Lublin, Poland)

Re:File searching all over hard drive


In article <65lh2a$ll...@nr1.toronto.istar.net> of Thu, 27 Nov 1997
23:29:04 in comp.lang.pascal.borland, Sheldon Marchand

Quote
<march...@execulink.com> wrote:

>    What is a easy way of searching for a file in TP 7? I want to be able to
>search in all the directories and the root also. Any ideas?

>Thanks

>Sheldon
>P.S. Please E-Mail me your ideas.

QHAH.  SigSep.  TSFAQP #12.
Consider http://www.merlyn.demon.co.uk/programs/listdirs.pas

--
John Stockton, Surrey, UK.    j...@merlyn.demon.co.uk    Turnpike v1.12    MIME.
  Web URL: http://www.merlyn.demon.co.uk/ - FAQqish topics, acronyms and links.
  Correct 4-line sig separator is as above, a line comprising "-- " (SoRFC1036)
  Before a reply, quote with ">" / "> ", known to good news readers (SoRFC1036)

Re:File searching all over hard drive


What you have to do using FindFirst and FindNext is recursively check
the attributes for sub directories so that you can then cd to them and
start your check again (hence recursively)...

Quote
Michal Urbanczyk wrote:
> Sheldon Marchand (march...@execulink.com) wrote:

> :     What is a easy way of searching for a file in TP 7? I want to be
> able to
> : search in all the directories and the root also. Any ideas?

> There are two instrucions in TP: FindFirst and FindNext. Just type any
> of
> these in your source and press CTRL-F1 for detailed informations.

> regards,
> Michal Urbanczyk
> (Lublin, Poland)

Re:File searching all over hard drive


Quote
> Sheldon Marchand wrote in message <65lh2a$ll...@nr1.toronto.istar.net>...
> What is a easy way of searching for a file in TP 7? I want to be able
> to|search in all the directories and the root also.
Jean-Sebastien Payette wrote:
> You need a recursive procedure to search all the directory.

Ugh! Recursion! What if you need to find 2 such files on your hard disc? Or
maybe all *.pas files? A better solution is to store information on the heap
(not forgetting to free it when you've finished, of course) so that you can
resume a search from where you left off.

Chris.

Re:File searching all over hard drive


On Sun, 30 Nov 1997 01:43:35 GMT, Chris Rankin

Quote
<net.bellsouth@{no.spam}rankinc> wrote:
>> Sheldon Marchand wrote in message <65lh2a$ll...@nr1.toronto.istar.net>...
>> What is a easy way of searching for a file in TP 7? I want to be able
>> to|search in all the directories and the root also.

>Jean-Sebastien Payette wrote:

>> You need a recursive procedure to search all the directory.

>Ugh! Recursion! What if you need to find 2 such files on your hard disc? Or
>maybe all *.pas files? A better solution is to store information on the heap
>(not forgetting to free it when you've finished, of course) so that you can
>resume a search from where you left off.

>Chris.

What's so bad about recursion?

Even Neil Rubenking uses it <g>

{ see if you can find Neil's unit FILESRCH.PAS }
{ It will do exactly what you want.  Try the AllSearcher() function }
{ I'd post it here but that is not allowed }

Re:File searching all over hard drive


Quote
micha...@frontiernet.net (michael) wrote:

>>> You need a recursive procedure to search all the directory.

>>Ugh! Recursion! What if you need to find 2 such files on your hard disc? Or
>>maybe all *.pas files? A better solution is to store information on the heap
>>(not forgetting to free it when you've finished, of course) so that you can
>>resume a search from where you left off.

>>Chris.

>What's so bad about recursion?
>Even Neil Rubenking uses it <g>
>{ see if you can find Neil's unit FILESRCH.PAS }
>{ It will do exactly what you want.  Try the AllSearcher() function }
>{ I'd post it here but that is not allowed }

I have written a all-file searcher in pascal. Write me if you want it.
You can specify a starting point and file mask (e.g: 'C:\DOS\*.Exe'
would start in the DOS directory on c:\, and search it all subdirs for
*.exe files.)

Re:File searching all over hard drive


In article <3481f90...@lynx.ozramp.net.au> of Mon, 1 Dec 1997 18:36:29
in comp.lang.pascal.borland, QarnoS <qar...@mindless.com> wrote:

Quote
>I have written a all-file searcher in pascal. Write me if you want it.
>You can specify a starting point and file mask (e.g: 'C:\DOS\*.Exe'
>would start in the DOS directory on c:\, and search it all subdirs for
>*.exe files.)

http://www.merlyn.demon.co.uk/programs/hunt.pas  &  ...exe
will do that; other properties include before/from file date, and
optionally executing a program on what is found.

--
John Stockton, Surrey, UK.    j...@merlyn.demon.co.uk    Turnpike v1.12    MIME.
  Web URL: http://www.merlyn.demon.co.uk/ - FAQqish topics, acronyms and links.
  Correct 4-line sig separator is as above, a line comprising "-- " (SoRFC1036)
  Before a reply, quote with ">" / "> ", known to good news readers (SoRFC1036)

Other Threads