This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: find / without traversing /proc


On 2017-04-27, bonhard wrote:
> The command "find /" takes forever, if it completes at all, because of the
> need to traverse the induced directory /proc. Is this directory often
> needed by users? Can it be skipped by setting up "export CYGWIN=something",
> or even by default, with the requirement on the user to induce it if needed?
> There seems to be no switch to the command find that would easily allow
> "but not this subdirectory": if there was, I wouldn't be asking. Quite a
> lot of surfing led me to
> $ find / \( -wholename /proc -o -wholename /dev \) -prune -o -print
> which is really heavyweight syntax for a simple requirement. I am pretty
> certain it leads to the behaviour required "do not traverse" though various
> posters seem to think it just leads to "traverse but do not report" saving
> almost nothing.
> Assuming the syntax is correct, I have not been able to incorporate any
> qualifiers such as -type d or -type f or -type l. Any ideas where to slot
> these so that they work?

This isn't exactly what you're looking for because it expands to
give find a list of places to look rather than just excluding some
set of directories from one place to look, but it seems to work
well. You'll need to have the extglob shopt set.

    $ find /!(dev|proc) ...

HTH,
Gary


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]