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

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



On 05/03/2017 12:34 PM, Richard Owlett wrote:
On 05/03/2017 10:13 AM, rhkramer@gmail.com wrote:
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.


*GRIN*
Been using that basic procedure since mid 1950's [when volume of single
flip-flop could be measured in cubic inches ;]

I had spent more than an hour:
 1. exploring find (with and without the -atime option)
 2. attempting to add -prune to the mix
That was when a series of links led to mywiki.wooledge.org .
An unknown amount of non-productive effort led to my post.

I thought I had narrowed the problem to -prune as that seemed the only
thing in common to failures was -prune.
The actual globing problem was hidden in the noise.
MEA CULPA: globs have bitten me before :{

Thanks all.

I should have included the final form that did what I wanted:

find /media/richard/pre-fail/home/richard \( \( -type d -name '.*' -prune \) -o \( -type d -name Downloads -prune \) -o \( -type d -name seamonkey -prune \) -o \( -type d -name websites -prune \) \) -o -atime -42 -print

It wasn't until I got the "-type d -name '.*' -prune" phrase correct that I realized how much other "noise" was in the original output ;/

A tutorial question for fellow neophytes:
What 2 things had been flagged as possible problem sources early on?







Reply to: