find without the "find: cannot read dir /usr/lost+found: Permission denied"

find without the "find: cannot read dir /usr/lost+found: Permission denied"

Post by Pete Houst » Fri, 15 Aug 1997 04:00:00



find / -name 'foo*.h' -print 2> /dev/null


|Hi all,
|
|Is there anyway to prevent find displaying the annoying
|
|find: cannot read dir /usr/lost+found: Permission denied
|
|message?
|
|For eg:
|
|find / -name 'foo*.h' -print

--

PO Box 220, Whiteknights, Reading, | Phone: +44-118-9875123 ext 7594
Berkshire, RG6 6AF, United Kingdom | Fax:   +44-118-9750203                
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WWW: http://www.rdg.ac.uk/~spr96phh/pete.html Use lynx - you know you want to!

 
 
 

find without the "find: cannot read dir /usr/lost+found: Permission denied"

Post by luv.. » Fri, 15 Aug 1997 04:00:00



> Hi all,

> Is there anyway to prevent find displaying the annoying

> find: cannot read dir /usr/lost+found: Permission denied

> message?

> For eg:

> find / -name 'foo*.h' -print

> Cheers.

unfortunately, find doesn't have an easy "readable by me" test, but
you can kludge something together if need be.  if your username is
"me", and your group is "mygroup", something like the following might
work: (WARNING: untested)

find / \( -type d -a \
          \! \( \( -user  me      -a -perm -0500 \) -o \
                \( -group mygroup -a -perm -0050 \) -o \
                \( -perm -0005 \) \
             \) -a \
          -prune \
       \) -o \( -name 'foo*.h' -print \)

best of luck,
andru

 
 
 

find without the "find: cannot read dir /usr/lost+found: Permission denied"

Post by EMF » Fri, 15 Aug 1997 04:00:00


Hi all,

Is there anyway to prevent find displaying the annoying

find: cannot read dir /usr/lost+found: Permission denied

message?

For eg:

find / -name 'foo*.h' -print

Cheers.

--
Eric M. F. Teo                                  
Logica BV                              

Postbus 22067                   telephone: (010)433-0844
3003 DB Rotterdam                      

 
 
 

find without the "find: cannot read dir /usr/lost+found: Permission denied"

Post by Michael P. Reil » Fri, 15 Aug 1997 04:00:00


: find / -name 'foo*.h' -print 2> /dev/null


: |Hi all,
: |
: |Is there anyway to prevent find displaying the annoying
: |
: |find: cannot read dir /usr/lost+found: Permission denied
: |
: |message?
: |
: |For eg:
: |
: |find / -name 'foo*.h' -print

There is also:

  find / -name lost+found -prune -o -name 'foo*.h' -print

This way, you still get the stderr output for other entries and it will
work across all the filesystems (which may not be a good idea.. using
find to scan from the root dir can be CPU intensive on some systems -
use -xdev or -fstype or the equivalent).

        Arcege

 
 
 

find without the "find: cannot read dir /usr/lost+found: Permission denied"

Post by luv.. » Fri, 15 Aug 1997 04:00:00



> Hi all,

> Is there anyway to prevent find displaying the annoying

> find: cannot read dir /usr/lost+found: Permission denied

> message?

> For eg:

> find / -name 'foo*.h' -print

> Cheers.

unfortunately, find doesn't have an easy "readable by me" test, but
you can kludge something together if need be.  if your username is
"me", and your group is "mygroup", something like the following might
work: (WARNING: untested)

find / \( -type d -a \
          \! \( \( -user  me      -a -perm -0500 \) -o \
                \( -group mygroup -a -perm -0050 \) -o \
                \( -perm -0050 \) \
             \) -a \
          -prune \
       \) -o \( -name 'foo*.h' -print \)

best of luck,
andru

 
 
 

find without the "find: cannot read dir /usr/lost+found: Permission denied"

Post by Don Quigl » Fri, 15 Aug 1997 04:00:00


Quote:> Hi all,

> Is there anyway to prevent find displaying the annoying

> find: cannot read dir /usr/lost+found: Permission denied

> message?

> For eg:

> find / -name 'foo*.h' -print

> Cheers.

Try:

find / -name 'foo*.h' -print 2> /dev/null

That'll send all of your error messages to /dev/null

--
-------

UNIX SysAdmin           Office: (612)903-1157
                        Home: (612)946-9948

 
 
 

find without the "find: cannot read dir /usr/lost+found: Permission denied"

Post by Paul Leath » Sat, 16 Aug 1997 04:00:00



>Hi all,
>Is there anyway to prevent find displaying the annoying
>find: cannot read dir /usr/lost+found: Permission denied
>message?
>For eg:
>find / -name 'foo*.h' -print

Yes, there is: simply add the following to the end of your command
line

2> /dev/null

This effectively puts all error messages in the Unix dustbin
(/dev/null)

 
 
 

find without the "find: cannot read dir /usr/lost+found: Permission denied"

Post by EMF » Tue, 19 Aug 1997 04:00:00




| > Hi all,
| >
| > Is there anyway to prevent find displaying the annoying
| >
| > find: cannot read dir /usr/lost+found: Permission denied
| >
| > message?
| >
| > For eg:
| >
| > find / -name 'foo*.h' -print
| >
|
| Try:
|
| find / -name 'foo*.h' -print 2> /dev/null
|
| That'll send all of your error messages to /dev/null

I've recieved this error message instead:

find: bad option 2
find: path-list predicate-list

I'm using tcsh, does that affect it?

 
 
 

find without the "find: cannot read dir /usr/lost+found: Permission denied"

Post by Peter Smulder » Sat, 23 Aug 1997 04:00:00





> | > Hi all,
> | >
> | > Is there anyway to prevent find displaying the annoying
> | >
> | > find: cannot read dir /usr/lost+found: Permission denied
> | >
> | > message?
> | >
> | > For eg:
> | >
> | > find / -name 'foo*.h' -print
> | >
> |
> | Try:
> |
> | find / -name 'foo*.h' -print 2> /dev/null
> |
> | That'll send all of your error messages to /dev/null
> I've recieved this error message instead:
> find: bad option 2
> find: path-list predicate-list
> I'm using tcsh, does that affect it?

Yes, the '2>' is Bourne shell syntax. Anyways it seems to me
not such a great idea to send *all* of find's error messages
to /dev/null. A less rigourous solution is to use a script like:

#!/bin/csh -f
/bin/find $argv |& grep -ve '^find: cannot'

--
Peter