Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I did RTMP. I am trying to find a directory with this command

find /users/dan/ -name 'Prams' -type d

I see a huge amount of 'No such file or directory' outputs. Is there a way to make find shutup if it doesn't find anything?

share|improve this question

migrated from stackoverflow.com Feb 25 '12 at 1:27

This question came from our site for professional and enthusiast programmers.

    
this worked for me: find /users/dan/ -name 'Prams' -type d | tee log –  nulltorpedo Feb 25 '12 at 1:41
    
the pipe without ampersand only outputs std output. If it was |& log, it will print those errors as well. –  nulltorpedo Feb 25 '12 at 1:42
add comment

3 Answers

Try this:

find /users/dan/ -name 'Prams' -type d 2>/dev/null
share|improve this answer
    
it says: find:paths must precede expression. I am running linux 2.6.9-67.0.7 –  nulltorpedo Feb 25 '12 at 1:32
    
which flavor: can you run uname -a –  Book Of Zeus Feb 25 '12 at 1:38
    
Linux machine-3 2.6.9-67.0.7.ELsmp #1 SMP Wed Feb 27 04:47:23 EST 2008 x86_64 x86_64 x86_64 GNU/Linux –  nulltorpedo Feb 25 '12 at 1:40
    
this worked for me: find /users/dan/ -name 'Prams' -type d | tee log –  nulltorpedo Feb 25 '12 at 1:40
    
interesting, this didn't work for me –  Book Of Zeus Feb 25 '12 at 1:42
show 2 more comments

You can suppress the STDERR output:

find /users/dan/ -name 'Prams' -type d 2> /dev/null

Or you can use find to show all directories and filter its output with grep:

find /users/dan -type d | grep "Prams"

The find command won't print "no such file or directory" if the search path (/users/dan, in this case) exists, even if there are no matches. Are you sure this directory exists?

share|improve this answer
add comment

His syntax is correct if indeed /users/dan/ < exists in the first place!

There should be no 'No such file or directory' outputs in the first place.

find $HOME -name 'Prams' -type d
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.