Computing.Net > Forums > Unix > Find command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Find command

Reply to Message Icon

Name: newone
Date: July 10, 2003 at 11:21:10 Pacific
OS: N/A
CPU/Ram: N/A
Comment:

Hi:
Suppose if I have a find command which looks in the current directory and subdirectories in it as follows,

find ./ -type f -name "file"

is there a way to specify within the find command asking it not to look in a particular subdirectory within the current directory ?



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: July 10, 2003 at 13:51:06 Pacific
Reply:

Hi:

If your version of find supports -prune you can do this:

find . -name yourdirtoskip -prune -o -print

Regards,

Nails


0

Response Number 2
Name: newone
Date: July 11, 2003 at 06:58:58 Pacific
Reply:

In the above command
find . -name yourdirtoskip -prune -o -print , what does -o do


0

Response Number 3
Name: nails
Date: July 11, 2003 at 14:04:52 Pacific
Reply:

Hi:

The -o is the boolean "or" operator. The way it works is that if the directory to skip is found, it's pruned (skipped) and everything after that i.e. the -print option is ignored. The -prune fails on every other obect, and that object prints.

Regards,

Nails


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Find command

Using find command www.computing.net/answers/unix/using-find-command-/2853.html

Limiting the find command www.computing.net/answers/unix/limiting-the-find-command/6637.html

find command - korn shell www.computing.net/answers/unix/find-command-korn-shell/5568.html