Command Line Maximum
Lennart Sorensen
lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Wed May 14 13:47:32 UTC 2008
On Wed, May 14, 2008 at 09:25:27AM -0400, Kevin Morris wrote:
> I have a script that uses mv to move a set of files. Whenever there are a very large number of files it fails, the reason: command line limit of a shell. I think xargs will resolve this problem, my question is how do I find this limit and any pointers on how to use xargs with the mv command in a bash script.
Different shells have different limits, and the OS you are running the
shell on also affects the limit. I think most systems allow 32k
characters, some more, some less. In general if you aren't sure how
many files you are about to deal with, use xargs to batch them. To make
spaces in filenames safe, use -print0 with find and -0 with xargs. And
always remember the 'don't run if no arguments' option to xargs as well.
--
Len Sorensen
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list