www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - BFS in recls

reply "Adi Shavit" <adish gentech.co.il> writes:
Hi Mathew,

  A feature of file searches I've been yearning for for years, is BFS
(Breadth First Search) searching.
When searching for a file you usually have general  idea about where it is.
The fact the dir. AAA has 100s of sub dirs. usually, isn't relevant, but
still they'll all be checked before going into the rest.
I'd love to see a BFS pattern file search, a.k.a onion peel searches ("Ogres
are like onions"...)

Thanks,
Adi
Aug 10 2004
next sibling parent reply "Matthew" <admin.hat stlsoft.dot.org> writes:
Do you mean search the files in a given directory before searching its
subdirectories? I think that's what it does
(though I now need to go and check).


"Adi Shavit" <adish gentech.co.il> wrote in message
news:cfbbp3$f0v$1 digitaldaemon.com...
 Hi Mathew,

   A feature of file searches I've been yearning for for years, is BFS
 (Breadth First Search) searching.
 When searching for a file you usually have general  idea about where it is.
 The fact the dir. AAA has 100s of sub dirs. usually, isn't relevant, but
 still they'll all be checked before going into the rest.
 I'd love to see a BFS pattern file search, a.k.a onion peel searches ("Ogres
 are like onions"...)

 Thanks,
 Adi
Aug 11 2004
parent reply "Adi Shavit" <adish gentech.co.il> writes:
yes and no.
Yes, check the files in a given directory before searching its
subdirectories, but that's not all.
The next directory you check is not one of the subdirs, but the files in a
sibling dir.

It's like peeling an onion.
Say the root is the starting dir.
First check the files in the root.
Then check the files a "distance" of one dir away from the root, in all the
roots subdir.
Then check the files in all the subdirs' subdirs, a distance of 2 from the
root and so on.
Of course, you must watch out for soft links etc.

The way you do this is quite simple algorithmically.
Just push all the subdirs of the current dir into a queue.
Dequeue the queue to get the next dir to search.
Stop when there are no more entries in the queue.

Naturally, see google.

Adi


"Matthew" <admin.hat stlsoft.dot.org> wrote in message
news:cfehb5$1f16$1 digitaldaemon.com...
 Do you mean search the files in a given directory before searching its
subdirectories? I think that's what it does
 (though I now need to go and check).


 "Adi Shavit" <adish gentech.co.il> wrote in message
news:cfbbp3$f0v$1 digitaldaemon.com...
 Hi Mathew,

   A feature of file searches I've been yearning for for years, is BFS
 (Breadth First Search) searching.
 When searching for a file you usually have general  idea about where it
is.
 The fact the dir. AAA has 100s of sub dirs. usually, isn't relevant, but
 still they'll all be checked before going into the rest.
 I'd love to see a BFS pattern file search, a.k.a onion peel searches
("Ogres
 are like onions"...)

 Thanks,
 Adi
Aug 15 2004
parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
Doh! What a goose am I. (Been having far too little time to think/sleep of
late. Well, that's my excuse and I'm sticking
to it ...)

BFS: Leave it with me. I can certainly see the utility in it, but it means
providng a separate search implementation, so
it'll have to be an option for version 1.8, or something like that. :)

"Adi Shavit" <adish gentech.co.il> wrote in message
news:cfon3g$16fl$1 digitaldaemon.com...
 yes and no.
 Yes, check the files in a given directory before searching its
 subdirectories, but that's not all.
 The next directory you check is not one of the subdirs, but the files in a
 sibling dir.

 It's like peeling an onion.
 Say the root is the starting dir.
 First check the files in the root.
 Then check the files a "distance" of one dir away from the root, in all the
 roots subdir.
 Then check the files in all the subdirs' subdirs, a distance of 2 from the
 root and so on.
 Of course, you must watch out for soft links etc.

 The way you do this is quite simple algorithmically.
 Just push all the subdirs of the current dir into a queue.
 Dequeue the queue to get the next dir to search.
 Stop when there are no more entries in the queue.

 Naturally, see google.

 Adi


 "Matthew" <admin.hat stlsoft.dot.org> wrote in message
 news:cfehb5$1f16$1 digitaldaemon.com...
 Do you mean search the files in a given directory before searching its
subdirectories? I think that's what it does
 (though I now need to go and check).


 "Adi Shavit" <adish gentech.co.il> wrote in message
news:cfbbp3$f0v$1 digitaldaemon.com...
 Hi Mathew,

   A feature of file searches I've been yearning for for years, is BFS
 (Breadth First Search) searching.
 When searching for a file you usually have general  idea about where it
is.
 The fact the dir. AAA has 100s of sub dirs. usually, isn't relevant, but
 still they'll all be checked before going into the rest.
 I'd love to see a BFS pattern file search, a.k.a onion peel searches
("Ogres
 are like onions"...)

 Thanks,
 Adi
Aug 15 2004
prev sibling parent "Matt Wilson" <matthewwilson acm.org> writes:
"Adi Shavit" <adish gentech.co.il> wrote in message 
news:cfbbp3$f0v$1 digitaldaemon.com...
 Hi Mathew,

  A feature of file searches I've been yearning for for years, is BFS
 (Breadth First Search) searching.
 When searching for a file you usually have general  idea about where it 
 is.
 The fact the dir. AAA has 100s of sub dirs. usually, isn't relevant, but
 still they'll all be checked before going into the rest.
 I'd love to see a BFS pattern file search, a.k.a onion peel searches 
 ("Ogres
 are like onions"...)
Well, recls 100%.NET (http://recls.net) has BFS. "Regular" recls still does not, alas, and that'll have to wait until recls 2.0.
Jun 17 2010