From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QiZGe-0002i4-Nh for garchives@archives.gentoo.org; Sun, 17 Jul 2011 21:52:53 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8149321C075; Sun, 17 Jul 2011 21:52:35 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by pigeon.gentoo.org (Postfix) with ESMTP id 921C621C056 for ; Sun, 17 Jul 2011 21:51:36 +0000 (UTC) Received: by fxd18 with SMTP id 18so5512169fxd.11 for ; Sun, 17 Jul 2011 14:51:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=XI90IHzkYHpiW1qtY4GOKe5GJURomWQhI9Sn58cOg0Q=; b=I17gLvJrVfJh4UuAUI0X0je8MBzxY6ILQTyYNXkXCB5C21Y1IZEc3UXDDmvAXO8B1m 8agF1FhZewL0RFNGdfAAHgaVg4VYBXDovdDMmz774K7Bs63wl2lqPYuKH16HfnoJipl0 O70iloJVOJsi2ULvM3MBr5SGhcBhHtAqfM+io= Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.223.146.1 with SMTP id f1mr6519037fav.48.1310939495686; Sun, 17 Jul 2011 14:51:35 -0700 (PDT) Received: by 10.223.161.206 with HTTP; Sun, 17 Jul 2011 14:51:35 -0700 (PDT) In-Reply-To: <3CvJ3DzDP2Vn.Bh2zCSVd@smtp.gmail.com> References: <3CvJ3DzDP2Vn.Bh2zCSVd@smtp.gmail.com> Date: Sun, 17 Jul 2011 17:51:35 -0400 Message-ID: Subject: Re: [gentoo-user] Any way around "Argument list too long"? From: Michael Mol To: gentoo-user@lists.gentoo.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 796e17ef1a33d6b5c4044f63410a6998 On Sun, Jul 17, 2011 at 3:54 PM, Pandu Poluan wrote: > -original message- > Subject: Re: [gentoo-user] Any way around "Argument list too long"? > From: Alan Mackenzie > Date: 2011-07-18 02:42 > >>Hi, Grant. >> >>On Sun, Jul 17, 2011 at 12:32:42PM -0700, Grant wrote: >>> My crontab deletes all files of a certain type in a certain folder >>> with yesterday's date in the filename. =C2=A0It usually executes but >>> sometimes fails with: >> >>> /bin/rm: Argument list too long >> >>> What would you do about this? >> >>Use xargs - in place of >> =C2=A0 =C2=A0/bin/rm lots of files ...... >> >>Use >> =C2=A0 Lots_of_file_names | xargs rm >> >>. =C2=A0xargs then calls rm several times with batches of filenames each = time. >>xargs is a standard Unix command. > > You'll want to be extra careful with special characters like (space), sin= gle quote, and double quote. > > Better use find ..... -exec rm {} + > This is why I use 'find' with the -print0 parameter. find (path) (filespec) -print0|xargs -0 command --=20 :wq