delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/10/09/03:05:33

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <470B288E.8060504@columbus.rr.com>
Date: Tue, 09 Oct 2007 03:06:54 -0400
From: Paul McFerrin <pmcferrin AT columbus DOT rr DOT com>
Reply-To: pmcferrin AT columbus DOT rr DOT com
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: -exec on find(1) broken
References: <470B1B1B DOT 2060404 AT columbus DOT rr DOT com> <20071009062547 DOT GA19172 AT suncomp1 DOT spk DOT agilent DOT com> <470B22FF DOT 10107 AT columbus DOT rr DOT com>
In-Reply-To: <470B22FF.10107@columbus.rr.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Well, I finally got it!

     find . -type f -mtime +18 -exec /bin/echo {} \; | more

is the correct syntax.  Now I just replace "/bin/echo" with "/bin/rm" 
and I ready to go.

-paul

Paul McFerrin wrote:
> Those ideas don't work either....
>
>    /i/mp3.$ find . -type f -mtime +18 -exec /bin/echo '\;' | more
>    find: missing argument to `-exec'
>
> while
>
>    /i/mp3.$ find . -type f -mtime +18 -exec /bin/echo ';' | more
>    /i/mp3.$ find . -type f -mtime +18 -exec /bin/echo \; | more
>
> both produces many empty lines as if there is NO argument being 
> passed.  The main purpose is to replace /bin/echo with /bin/rm when I 
> get the argument figured out.  I think -exec is really broken.  If you 
> can get a working example, let me know.
>
> -paul
>
>  
>
> Gary Johnson wrote:
>> On 2007-10-09, Paul McFerrin wrote:
>>  
>>> I think I'm going nuts.  What am I doing wrong?  Can't seem to get 
>>> -exec to work.
>>>
>>>    /i/mp3.$ find . -type f -mtime +18 -exec /bin/echo \{\;\} | more
>>>    find: missing argument to `-exec'
>>>    /i/mp3.$ find . -type f -mtime +18 -exec /bin/echo \{\} | more    
>>> find: missing argument to `-exec'
>>>    /i/mp3.$ find . -type f -mtime +18 -exec /bin/echo '\;' | more
>>>    find: missing argument to `-exec'
>>>    /i/mp3.$ find . -type f -mtime +18 -exec /bin/echo \{;\} | more
>>>    find: missing argument to `-exec'
>>>    /i/mp3.$ find . -type f -mtime +18 -exec echo '\;' | more
>>>    find: missing argument to `-exec'
>>>
>>> There is NO missing argument to -exec.  What gives?  Is it really 
>>> broken or do I not understand the manual page correctly?
>>>     
>>
>> You're putting too many quotes around the semicolon.  Use
>>
>>    \;
>>
>> or
>>
>>    ';'
>>
>> but not both.  For example,
>>
>>    find . -type f -mtime +18 -exec /bin/echo \; | more
>>
>> If you want to echo the name of each file found, use {} like this:
>>
>>    find . -type f -mtime +18 -exec /bin/echo {} \; | more
>>
>> However, if that's all you want to do, the -exec isn't 
>> necessary--just use -print:
>>
>>    find . -type f -mtime +18 -print | more
>>
>> In modern implementations of find, such as Cygwin's, the -print 
>> usually isn't necessary either, so you could get by with just this:
>>
>>    find . -type f -mtime +18 | more
>>
>> Also, please don't start new threads by replying to other posts--it 
>> messes up threading.  Send mail directly to the list instead.
>>
>> Regards,
>> Gary
>>
>> -- 
>> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>> Problem reports:       http://cygwin.com/problems.html
>> Documentation:         http://cygwin.com/docs.html
>> FAQ:                   http://cygwin.com/faq/
>>
>>   
>
> -- 
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
>

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019