X-Spam-Check-By: sourceware.org Message-ID: <44A4F211.F8B11DC1@dessent.net> Date: Fri, 30 Jun 2006 02:42:41 -0700 From: Brian Dessent X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: find missing parameter References: <5116344 DOT post AT talk DOT nabble DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com prz wrote: > I have a small problem with find command > whenever I specify the -exec option this error is displayed > > /cygdrive/c/workdir: find . -name "db*" -mtime +2 -type f -exec /bin/rm {} > find: missing argument to `-exec' > > tried quotes - single double ... with/without path to rm or any other > command (ls) > removing the exec returns the correct file None of this is Cygwin-specific. First, -exec is a bad way to do this. It will have to fork/exec a copy of rm once for each file to be deleted, which is extraordinarily slow under Cygwin. Use xargs instead: find . -name db\* -mtime +2 -type f -print0 | xargs -0 rm This will result in rm being called only once with all the filenames to delete as arguments (unless the total length is too great to fit on one command line, in which case rm will be called as many times as necessary, but still much less than once per file.) If you really want to use -exec even though it's horribly slow, then re-read the find manpage, as you are missing the trailing semicolon that tells -exec when the argments end. This makes it possible to include further 'find' options after -exec without them being treated as arguments to -exec, for example: find . -type f -exec cmd {} \; -print Note that semicolon is a shell special character so you have to quote it if you want to pass a literal semicolon to find, just as you have to do with * in -name. Brian -- 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/