I'm trying to use the find and execute commands to remove *.html files
in various subdirectories within a single directory but the command
returns "missing argument to `-exec'
the command I've entered is:
find -type f -exec rm -rf"
followed by the path, followed by:
-iname '*.html'
Find alone has found all the files but I'm not understanding what is
wrong with the syntax "-exec rm -rf"
Can someone see an obvious error?
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Sat Jan 14 13:30:01 2012
Return-path: <devel-bounces@lists.fedoraproject.org>
Envelope-to: tom@linux-archive.org
Delivery-date: Sat, 14 Jan 2012 13:21:42 +0200
Received: from bastion01.fedoraproject.org ([209.132.181.2]:35313 helo=bastion.fedoraproject.org)
by s2.java-tips.org with esmtp (Exim 4.69)
(envelope-from <devel-bounces@lists.fedoraproject.org>)
id 1Rm1g6-0001qM-Mt
for tom@linux-archive.org; Sat, 14 Jan 2012 13:21:42 +0200
Received: from lists.fedoraproject.org (collab03.vpn.fedoraproject.org [192.168.1.70])
by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id 414DE21568;
Sat, 14 Jan 2012 11:21:45 +0000 (UTC)
Received: from collab03.fedoraproject.org (localhost [127.0.0.1])
by lists.fedoraproject.org (Postfix) with ESMTP id 7DCED415C5;
Sat, 14 Jan 2012 11:21:44 +0000 (UTC)
X-Original-To: devel@lists.fedoraproject.org
Delivered-To: devel@lists.fedoraproject.org
Received: from smtp-mm01.fedoraproject.org (smtp-mm01.fedoraproject.org
[80.239.156.217])
by lists.fedoraproject.org (Postfix) with ESMTP id 30FDA4153B
for <devel@lists.fedoraproject.org>;
Sat, 14 Jan 2012 11:21:27 +0000 (UTC)
Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com
[209.85.212.173])
by smtp-mm01.fedoraproject.org (Postfix) with ESMTP id 9D89FC0818
for <devel@lists.fedoraproject.org>;
Sat, 14 Jan 2012 11:21:25 +0000 (UTC)
Received: by wibhm11 with SMTP id hm11so1240559wib.32
for <devel@lists.fedoraproject.org>;
Sat, 14 Jan 2012 03:21:24 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
h=message-id:date:from:user-agent:mime-version:to:subject:references
:in-reply-to:content-type:content-transfer-encoding;
bh=70VcyaZEujfm2pw1vGeJrsVEtlP7GUKecpshSO3vMQ4=;
b=oXr4/ZFkOvagKhdej6wZfCGK3AdDRISLCR6wLgkJmiT0KmT0MffyPTH y92aO0at0Ga
1duNKJhSU+OXxLoP9B7VXhWcc1bdbsO75N/3CH9YgCD5WknAt6J3Ns3BT3mnFhUHR15X
FMkO8gx/B07DfFuNIGr2c7q0GjA9JA1ECtlWg=
Received: by 10.180.83.72 with SMTP id o8mr2539448wiy.22.1326540084553;
Sat, 14 Jan 2012 03:21:24 -0800 (PST)
Received: from localhost.localdomain (85-220-55-128.dsl.dynamic.simnet.is.
[85.220.55.128])
by mx.google.com with ESMTPS id fc6sm10084645wbb.16.2012.01.14.03.21.22
(version=SSLv3 cipher=OTHER); Sat, 14 Jan 2012 03:21:23 -0800 (PST)
Message-ID: <4F1164FD.401@gmail.com>
Date: Sat, 14 Jan 2012 11:20:29 +0000
From: =?UTF-8?B?IkrDs2hhbm4gQi4gR3XDsG11bmRzc29uIg==?=
<johannbg@gmail.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
rv:9.0) Gecko/20111222 Thunderbird/9.0
MIME-Version: 1.0
To: devel@lists.fedoraproject.org
Subject: Re: [ACTION REQUIRED] Retiring packages for F-17
References: <20120113161113.GA6202@nostromo.devel.redhat.com >
<jeq2lu$8iu$1@dough.gmane.org> <20120113225100.4cb65249@gmail.com>
<4F11596E.8040509@gmail.com>
<CAEUgiHcK9bU-COMD27d3zu29ip=2t=oBRxEwYLCGv2j7FYT-6w@mail.gmail.com>
In-Reply-To: <CAEUgiHcK9bU-COMD27d3zu29ip=2t=oBRxEwYLCGv2j7FYT-6w@mail.gmail.com>
X-BeenThere: devel@lists.fedoraproject.org
X-Mailman-Version: 2.1.12
Precedence: list
Reply-To: Development discussions related to Fedora
<devel@lists.fedoraproject.org>
List-Id: Development discussions related to Fedora
<devel.lists.fedoraproject.org>
List-Unsubscribe: <https://admin.fedoraproject.org/mailman/options/devel>,
<mailto:devel-request@lists.fedoraproject.org?subject=unsubscrib e>
List-Archive: <http://lists.fedoraproject.org/pipermail/devel/>
List-Post: <mailto:devel@lists.fedoraproject.org>
List-Help: <mailto:devel-request@lists.fedoraproject.org?subject=help>
List-Subscribe: <https://admin.fedoraproject.org/mailman/listinfo/devel>,
<mailto:devel-request@lists.fedoraproject.org?subject=subscribe>
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Sender: devel-bounces@lists.fedoraproject.org
Errors-To: devel-bounces@lists.fedoraproject.org
On 14 January 2012 11:19, CJ Tres <ctres@grics.net> wrote:
> I'm trying to use the find and execute commands to remove *.html files in
> various subdirectories within a single directory but the command returns
> "missing argument to `-exec'
>
> the command I've entered is:
> find -type f -exec rm -rf"
> followed by the path, followed by:
> -iname '*.html'
>
> Find alone has found all the files but I'm not understanding what is wrong
> with the syntax "-exec rm -rf"
>
> Can someone see an obvious error?
man find shows an example similar to your requirement
find . -type f -exec file '{}' ;
which suggests that you have got some bits missing from the exec spec.
Colin
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
01-14-2012, 10:42 AM
PleegWat
exec command
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 01/14/2012 12:19 PM, CJ Tres wrote:
> I'm trying to use the find and execute commands to remove *.html
> files in various subdirectories within a single directory but the
> command returns "missing argument to `-exec'
>
> the command I've entered is: find -type f -exec rm -rf" followed by
> the path, followed by: -iname '*.html'
>
> Find alone has found all the files but I'm not understanding what
> is wrong with the syntax "-exec rm -rf"
>
> Can someone see an obvious error?
>
You need to terminate the argument to -exec with a ;, which needs to
be quoted or escaped for the shell, and you need to include an
argument of {} which will be replaced by the name of the file find has
found. You also seem to have confused the argument order to find.
Here you should fill your path for $path.
Specifically when deleting files, you may also use the find action
- -delete, which has the same effect as -exec rm:
find $path -type f -iname '*.html' -delete
This version should be faster when a lot of files need to be deleted.
PleegWat
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/