Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jun 2011 00:59:29 -0400
From:      Jason Hellenthal <jhell@DataIX.net>
To:        Eitan Adler <lists@eitanadler.com>
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: misc/157491: update ls/rm/mv/cp tools to be able to handle large amount of files
Message-ID:  <20110602045929.GB3103@DataIX.net>
In-Reply-To: <201106011200.p51C0X0o012189@freefall.freebsd.org>
References:  <201106011200.p51C0X0o012189@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--NDin8bjvE/0mNLFQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable


On Wed, Jun 01, 2011 at 12:00:33PM +0000, Eitan Adler wrote:
> The following reply was made to PR misc/157491; it has been noted by GNAT=
S.
>=20
> From: Eitan Adler <lists@eitanadler.com>
> To: bug-followup@freebsd.org, vermaden@interia.pl
> Cc: =20
> Subject: Re: misc/157491: update ls/rm/mv/cp tools to be able to handle l=
arge
>  amount of files
> Date: Wed, 1 Jun 2011 11:59:36 +0000
>=20
>  The limit is not in these tools. It is a constant number, defined in
>  bytes, in the kernel. This is designed to keep the amount of memory
>  required to store these command line options bounded.
>  You could see the value with
>  $getconf ARG_MAX
>  262144
> =20
>  I suggest you use find + xargs which automatically will figure out the
>  correct number of arguments and run the command for you.
> =20

Even using your shell to do this will yield better results than trying
to pass every file as an argument. Knowledge of how the shell works in
this manner can be learned from the manual and through some scripting
guides out there on the net "somewhere".

While find is just as sufficient, here is another example that will use
just the tools you mentioned.

mkdir -p /usr/obj/tmp_m
for file in /var/db/portsnap/files/*; do
	cp -v $file /usr/obj/tmp_m
done


This is probably one of the most commonly used shell scripting examples.

Large things can be done here. Good Luck.

--=20

"Unity can only be manifested by the Binary. Unity itself and the idea of U=
nity are already two." -- Buddha

 Regards, (jhell)
 Jason Hellenthal


--NDin8bjvE/0mNLFQ
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (FreeBSD)
Comment: http://bit.ly/0x89D8547E

iQEcBAEBAgAGBQJN5xiwAAoJEJBXh4mJ2FR+gAkIAKBw5gJxfekj5XBhL+pll21c
entucnMPlR3dEqemMWbnOyRFK659lzi05kN2hBddn1YYUfBUwcnaiXnmmO+i1QIG
224ynFMigtNMWQqRwLNXz7V7cLVQs5bG3DnF3Ym7bBOZqMZuzma3fMHm+awuu2A4
JF9oiqMxaBOBRKhewr02S4nSDf+lbC4hHiP5wLs+8uTZhCogibd4DA7inrS+K+gK
uBZeCjXpk6NnZpNoU2R3fEe39mFmJkQYrr5X7qlojprpVs7zJEEXpIEV++KCjff0
RB6l23hEDtydZeSfu45nnaP5mC+ka8FPl55mqSyYMJI+D/ChKRYbbmZFtB6/1Xo=
=AEUf
-----END PGP SIGNATURE-----

--NDin8bjvE/0mNLFQ--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110602045929.GB3103>