[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using -prune option of find to ignore hidden directories

On Wednesday, May 03, 2017 10:57:09 AM Richard Owlett wrote:
> The man page for find confuses me.
> Looking for explanatory material I found and tried to follow examples in
> http://mywiki.wooledge.org/UsingFind#A-prune .
> I tried
>    find /home/richard \( -type d -name .* -prune \) -o -atime -42 -print
> and
>    find /home/richard \( -type d -name .* -prune \) -atime -42 -print
> unsuccessfully.
> Each got an "find: paths must precede expression: .." error
> HOW?

Can't answer your question off the top of my head, but, when I run into 
problems like this, I try to run subsets of the command to try to narrow down 
the problem.  For example, I might first try find /home/richard--see if it works 
(provides any output) and what that output looks like, then try adding 
switches or other parts of the command one at a time.

Maybe next I'd try:

find /home/richard -type d -name .* (without the escaped parens), then maybe 
add the parens (I've never tried parens in a command like that, so am not sure 
they work, and then continue adding switches (or whatever) pretty much one at 
a time.

If I have to ask for help on the mailing list, I'd try to provide the command 
that I think I want to run (but didn't) (as you did), but also one or more of 
the commands I tried and did work.

Reply to: