Using "find" in a script..

John Kodis kodis at mail630.gsfc.nasa.gov
Tue Apr 20 14:59:02 UTC 2004


On Tue, Apr 20, 2004 at 03:51:08PM +0100, WipeOut wrote:

> The command that should do its is..
> 
> find /backups/fcws/ -mtime +15 -maxdepth 1 -type d -exec rm -rf {};
> 
> The problem is that because there are currently no directories to delete 
> I get the error..
> 
> find: missing argument to `-exec'

You're mistaken about the cause of the error.  An "rm -rf" will work
just fine without any arguments.  The problem is that the -exec isn't
seeing the semicolon that it's looking for.  Try this instead:

    find /backups/fcws/ -mtime +15 -maxdepth 1 -type d -exec rm -rf {} \;

-- 
John Kodis                                    Goddard Space Flight Center
kodis at mail630.gsfc.nasa.gov                      Greenbelt, Maryland, USA
Phone: 301-286-7376                                     Fax: 301-286-1771





More information about the fedora-list mailing list