[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Command failure: Too Many Files (rm, ls, tar)
From: |
Bob Proulx |
Subject: |
Re: Command failure: Too Many Files (rm, ls, tar) |
Date: |
Tue, 15 Apr 2008 10:55:35 -0600 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Browder, Tom wrote:
> Last week I started getting errors indicating there were too many files
> for the command (rm *, ls *, tar cvzf xfer.tgz *) to continue.
> ...
> Is there a magic number limit on those commands?
> Or am I doing something wrong.
You are running into the kernel's ARG_MAX limitation. Please see this
reference for more information.
http://www.gnu.org/software/coreutils/faq/#Argument-list-too-long
> I regularly copy the files to a transfer directory, cd to that
> directory, and tar them and gzip them (tar cvzf xfer.tgz *) to take
> them to another site.
For your 'tar' case you can avoid the argument expansion entirely
simply by giving '.' as the argument.
tar cvzf xfer.tgz .
For 'rm *' I would normally either simply remove the entire directory
with 'rm -rf ./dir' or use 'find' like this:
find . -exec rm {} +
For 'ls *' there is no need of the '*'. Just use ls. Actually using
'ls *' is inefficient because the shell expands the * to match every
filename in the directory and ls then lists it. But the entire
purpose of ls is to list directories. So 'ls *' does the same work
twice while 'ls' does it once. Better to simply use 'ls'.
ls
Bob
- Command failure: Too Many Files (rm, ls, tar), Browder, Tom, 2008/04/15
- Re: Command failure: Too Many Files (rm, ls, tar),
Bob Proulx <=
- RE: Command failure: Too Many Files (rm, ls, tar), Browder, Tom, 2008/04/15
- Re: Command failure: Too Many Files (rm, ls, tar), Ralf Wildenhues, 2008/04/15
- Re: Command failure: Too Many Files (rm, ls, tar), Bob Proulx, 2008/04/15
- Re: Command failure: Too Many Files (rm, ls, tar), Ralf Wildenhues, 2008/04/15
- Re: Command failure: Too Many Files (rm, ls, tar), Bob Proulx, 2008/04/15
- Re: Command failure: Too Many Files (rm, ls, tar), Karl Berry, 2008/04/15
- RE: Command failure: Too Many Files (rm, ls, tar), Browder, Tom, 2008/04/15