The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
takes time to connect my application Gods_help SUN Solaris 2 11-06-2008 12:10 PM
shell script takes long time to complete ozzman Shell Programming and Scripting 12 02-05-2007 11:25 PM
why shell scripting takes more time to read a file brkavi_in Shell Programming and Scripting 1 06-23-2006 08:20 AM
fwrite takes extremely long time inna High Level Programming 5 07-06-2005 06:19 AM
Writing file to disk takes time nileshkarania UNIX for Dummies Questions & Answers 7 06-16-2003 08:51 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-18-2008
knijjar knijjar is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 27
find command takes a lot of time ( can I skip directories)

I have a file called "library" with the following content

libnxrdbmgr.a
libnxrdbmgr.so
libnxtk.a
libnxtk.so
libora0d_nsc_osi.so

I am trying to locate if these libraries are on my machine or not. find command runs for about few seconds and hangs after this.
Can someone please help me and let me know if there is a better way. Is there a way I can ignore a directory and its sub directories during the find process

find: cannot read dir /ssttools/performance/RMCmem: Permission denied


$ for i in `cat library`
do
find / -name $i -print | grep $i >> outputfile
done




find: cannot read dir /proc/24250: Permission denied
find: cannot read dir /proc/17502: Permission denied
find: cannot read dir /tmp/smc898: Permission denied
find: cannot read dir /tmp/config_pvr: Permission denied
find: cannot read dir /export/home/dwgore/.rhosts: Permission denied
find: cannot read dir /export/home/mgalvin/.rhosts: Permission denied
find: cannot read dir /export/home/nmsbb/.ssh: Permission denied
find: cannot read dir /export/home/www/.ssh: Permission denied
find: cannot read dir /ssttools/performance/RMCmem: Permission denied

It is taking a lot of time here before it can go to next
  #2 (permalink)  
Old 03-18-2008
knijjar knijjar is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 27
There are few directories which I want the find command to skip or ignore and move on. How do I modify the find command so that it skips these directories

find: cannot read dir /export/home/www/.ssh: Permission denied

find: cannot read dir /ssttools/performance/RMCmem: Permission denied
find: cannot read dir /ssttools/tng/focus: Permission denied
  #3 (permalink)  
Old 03-19-2008
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
from the man pages:
Code:
       -path pattern
              File name matches shell pattern pattern.  The metacharacters do not treat ‘/’  or  ‘.’  specially;  so,  for
              example,
                        find . -path ’./sr*sc’
              will  print an entry for a directory called ’./src/misc’ (if one exists).  To ignore a whole directory tree,
              use -prune rather than checking every file in the tree.  For example, to skip the directory ‘src/emacs’  and
              all files and directories under it, and print the names of the other files found, do something like this:
                        find . -path ’./src/emacs’ -prune -o -print
  #4 (permalink)  
Old 08-12-2008
moncul moncul is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 1
How about a situation where you only want to find all regular files, but omit certain directories? Eg, i tried:

find . -name 'dir1' -prune -o name 'dir2' -prune -o type f

And the above does give me just regular files, except i get an entry for 'dir1' and 'dir2'; even though none of the files underneath these directories appear in the final list (which is what i want). I also want to omit the 'dir1' and the 'dir2' entries. They're the only things that show up in my output that are not regular files.

Thanks.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 03:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0