bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature request: breadth-first traversal


From: Malte Forkel
Subject: Re: feature request: breadth-first traversal
Date: Sat, 16 May 2009 19:50:01 +0200
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

James Youngman schrieb:
> On Sat, May 16, 2009 at 8:32 AM, Malte Forkel <address@hidden> wrote:
>> Hi,
>>
>> I'd like to suggest adding an option
>>
>>  -breadth   Process each directory before its contents
> 
> Could you give an example to indicate (1) how your proposal differs
> from find's existing behaviour and (2) why it would be useful, please?
> 

I was looking for a way to selectively list the contents of a directory
tree. For easier reading, the list should be ordered in a "top-down"
fashion. I.e., I wanted to list all files in a directory before its
subdirectories and their respective contents.

This is similiar to the output of the tree command, but more versatile
due to find's ability to select and operate on the entries found.

With the existing options, I don't know how to achieve this. Doing
anything like
   $ find . -type d -or -name <pattern>
or
   $ find . -depth -type d -or -name <pattern>
or
   $ find . -type d -or -name <pattern> | sort
always results in listings which mix files and subdirectories. That's
because ordering is based on internal directory structure (I guess) or
alphabet (with sort).

Other people seem to be trying to do similiar things, see e.g.
http://stackoverflow.com/questions/539583/how-do-i-recursively-list-all-directories-at-a-location-breadth-first

Thanks,
Malte





reply via email to

[Prev in Thread] Current Thread [Next in Thread]