find - How to get rid of can not open msg


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers find - How to get rid of can not open msg
# 1  
Old 11-28-2004
find - How to get rid of can not open msg

I am trying to list file names that contains a give string using this command:
$ find . -name "*" -maxdepth 1 -exec grep "*mystring*" {} \;

I get lots of messages like the ones below:

grep: Cannot open file './NTUSER.DAT': Device busy
grep: Cannot open file './ntuser.dat.LOG': Device busy

My quesiton is:
1- Is the above command correct?
2- Is there a way to get rid of the messages and only keep the files that were opened OK?

Thanks,

Smilie
# 2  
Old 11-28-2004
Your command is correct. You're running the command against a windows partition of some kind (are you running cygwin/interix/mks?) NTUSER.dat* will be in use via a login and thus will report busy. If under Windows you try to move/copy/etc NTUSER.dat* and from C:\documents and settings\someuser\ and "someuser" is logged in this behaviour will occur too.

You can redirect STDERR to /dev/null to send the error output to the bit bucket...

e.g.
<my find command here> 2> /dev/null

Cheers
ZB
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to find Error: rpmdb open failed on list of servers

Hello all, I have a task to patch red hat servers and some servers have a corrupted rpm database and return the error: Error: rpmdb open failed I know how to fix this when it occurs. What I'm hoping to do is scan a list of servers by IP and report back which server have this error. ... (6 Replies)
Discussion started by: greavette
6 Replies

2. UNIX for Beginners Questions & Answers

0403-016 Cannot find or open the file in If Statement

Hi, I am comparing the number of records in the .bad record from sql loader, if it is higher than the number passed in as an argument, the program should exit. However, I constantly receive the error " 0403-016 Cannot find or open the file." on the line with the if statement "elif ;". The code... (3 Replies)
Discussion started by: MIA651
3 Replies

3. Shell Programming and Scripting

Problem with find command "find: cannot open"

Hello Guys , I am trying to run below find command in one of my SH script on a HP UX machine. find /tmp -type f -name "MGCA*.log" -prune -exec rm -f {} \; 2>&1 I want this to check my tmp directory and delete MGCA log files .But below error message is printed on Promt :- find: cannot... (2 Replies)
Discussion started by: himanshu sood
2 Replies

4. UNIX for Dummies Questions & Answers

Where can I find a list of POSIX certificated OS by open group?

Linux is said to be POSIX compliant but can't be named UNIX while Solaris, AIX, HP-UX are named UNIX. Where can I get a list of certificated UNIX? I can't find it in opengroup.org (1 Reply)
Discussion started by: vistastar
1 Replies

5. UNIX for Advanced & Expert Users

How can I find out the open files in a directory

Hello all, Is there any other way of finding the open files in a directory apart from command 'lsof'. thanks (3 Replies)
Discussion started by: joshi123
3 Replies

6. UNIX for Dummies Questions & Answers

how to find the owner PID of open socket on Solaris9?

Hi all, I am trying to connect the open socket and its owner PID on my Solaris9 system. But it seems not very easy. As netstat is not as powerful as it is on Linux platform, without the "-program" option, and "lsof -i <UDP|TCP>@<hostIP>" won't show the one i want although it lists some... (1 Reply)
Discussion started by: sleepy_11
1 Replies

7. Solaris

Error Message: find: cannot open /: Stale NFS file handle

I am using the "find" command below and it respond with the error message " find: cannot open /: Stale NFS file handle" what does it mean? what can I do about it? Need advice, thanks. below are the command that I enter, the respond and the error message: root@ScripServer:/# find / -name... (1 Reply)
Discussion started by: ezsurf
1 Replies

8. Shell Programming and Scripting

msg??

I want to display a message when the script is done running, but I do not want to use echo. Is there another command I can use besides echo? If so, show me how it is done. (1 Reply)
Discussion started by: dshea0001
1 Replies

9. Programming

msg q

hi... i posted the code earlier but it wasnt quite readbale... ive added a few comments and made the indentation problem right... the problem is that it doent seem to be working... ive almost pulled out my hair tryin to fix the prob another wierd thing is that it worksthe 1st time when i... (0 Replies)
Discussion started by: strider
0 Replies

10. Programming

msg q again!

is it possible to use a msg queue with multiple threads spawned from the same app? (1 Reply)
Discussion started by: strider
1 Replies
Login or Register to Ask a Question