1827294 Members
3414 Online
109717 Solutions
New Discussion

find command

 
SOLVED
Go to solution
Ridzuan Zakaria
Frequent Advisor

find command

Hi,

How do I use find command in the following situation:

- I want to search anything under /home/user expect /home/user/guest directory

Thanks.
quest for perfections
6 REPLIES 6
Pete Randall
Outstanding Contributor

Re: find command

If you simply don't want to see any output from the /home/user/guest directory you can grep it out:

find /home/user |grep -v '/home/user/guest'


Pete

Pete
Rodney Hills
Honored Contributor

Re: find command

find /home/user ! -path "/home/user/guest"

HTH

-- Rod Hills
There be dragons...
Sanjay_6
Honored Contributor
Solution

Re: find command

Hi,

you can also use the -prune option with the find command,

find /home/user -type f ! -path "/home/user/guest/*" -prune -print

Hope this helps.

Regds
Sanjay_6
Honored Contributor

Re: find command

Hi,

If you want to include all files / directories, you can also use,

find /home/user ! -path "/home/user/guest/*" -print

Hope this helps.

regds

Ridzuan Zakaria
Frequent Advisor

Re: find command

I use Sanjay's suggestion.

Thanks
quest for perfections
Ridzuan Zakaria
Frequent Advisor

Re: find command

I use Sanjay's suggestion
quest for perfections