find specific named directory while excluding specific named directory
Have no problem using find to search for directories with a specific name. Also don't have a problem using find to exclude directories with a specific name.
What has me stumped is doing both simultaneously. Finding directories with a specific name while also excluding other named directories seems to require voodoo. One solution is piping to grep but I need a solution that only uses find. On our network we use a utility called snapshot (not the screen capture tool). Snapshot keeps several backups in a subdirectory called .snapshot. Not only does it keep several backups but .snapshot could exist in more that one place. This causes find to take an extremely long time to run. That's why piping to grep is not a solution. Basically need to find directories named 'setup' while excluding directories name '.snapshot'. Tried several things with prune and '!' and nothing so far has worked. I am open to suggestions. Many thanks in advance. |
What have you tied so far?
Have you taken a look at the -prune and -maxdepth parameters? --C |
Quote:
Quote:
|
Try putting "prune" first...
Here is an example of what I use on my server Code:
find . -name .snapshot -prune -o -name setup -type d --C |
Quote:
Quote:
|
Quote:
Code:
~$ find /path/to/search -type d -name '.snapshot' -prune -o -type d -name 'setup' -print |
Quote:
I'll let you know how it turns out. Thanks, |
All times are GMT -5. The time now is 05:56 PM. |