'rm' Can not delete files

Matthew Story matthewstory at gmail.com
Fri Feb 10 16:08:50 UTC 2012


On Fri, Feb 10, 2012 at 11:04 AM, Matthew Story <matthewstory at gmail.com>wrote:

> On Fri, Feb 10, 2012 at 10:51 AM, Da Rock <
> freebsd-questions at herveybayaustralia.com.au> wrote:
>
>> On 02/11/12 01:34, Henry Olyer wrote:
>>
>>> So what do I change if I want to increase the shell's file limit?
>>>
>> I don't think you can. It's not a shell limit. It's a limit to the number
>> of arguments the command itself will take. As said, the shell expands '*'
>> to a list of files as the argument, and rm is limited to the number of
>> arguments it will parse.
>>
>>  I use bash 4.
>>>
>>> And by the way, for me, part of the normal installation of a new FBSD box
>>> is to make certain changes.  For example, for "uniq -c" I use "%06"
>>> instead
>>> of "%d" because this way I can sort the output.  Things like that.
>>>
>>> I never learned a shell language.  I suppose no one is as dumb as someone
>>> who choose's not to learn, so, what's the right one.  csh?, because I do
>>> a
>>> lot of scientific work?, or should I be looking at another?
>>>
>> There's not really much difference in this factor for shell types; as for
>> changes you'd have to hack the command's (say rm) code.
>>
>> As mentioned, I'd use the find -delete combination.
>
>
> I think the only thing that would give you this sort of pseudo-granularity
> of MAX_ARGS (and ARG_MAX) control at run-time is xargs with the -s and -n
> options ... a play on andrew's earlier example:
>
>
find . -type f -depth 1 -print0 | xargs -n99 -0 -s8192 -c5 rm --
>

the -c5 here should read -P5 ... apologies.


> or some such, depending on your needs, I believe in most situations this
> particular invocation will also out-perform find ... -delete.
>
>
>>  On Wed, Feb 8, 2012 at 10:25 PM, andrew clarke<mail at ozzmosis.com>
>>>  wrote:
>>>
>>>  On Tue 2012-02-07 23:17:16 UTC+0000, RW (rwmaillists at googlemail.com)
>>>> wrote:
>>>>
>>>>  On Tue, 07 Feb 2012 22:14:56 +0000
>>>>> Matthew Seaman wrote:
>>>>>
>>>>>  ls -1 | xargs rm
>>>>>>
>>>>> but be aware that that wont work for filenames with spaces.
>>>>>
>>>> In addition, I don't believe it solves the OP's initial problem of the
>>>> argument list being too long!  You'd probably need to use the xargs -n
>>>> switch here.
>>>>
>>>> The above will also try to 'rm' directories, which won't work.
>>>>
>>>> Instead I would use 'find':
>>>>
>>>> find . -type f -depth 1 -delete
>>>>
>>>> This will also work with filenames with spaces.
>>>>
>>>> Or the scenic route, using xargs, with one rm per file (slower):
>>>>
>>>> find . -type f -depth 1 -print0 | xargs -n1 -0 rm -f
>>>>
>>>> (The "scenic route" is useful if you want to do something else with
>>>> the files instead of deleting them with rm.)
>>>>
>>>> Regards
>>>> Andrew
>>>> ______________________________**_________________
>>>> freebsd-questions at freebsd.org mailing list
>>>> http://lists.freebsd.org/**mailman/listinfo/freebsd-**questions<http://lists.freebsd.org/mailman/listinfo/freebsd-questions>
>>>> To unsubscribe, send any mail to "
>>>> freebsd-questions-unsubscribe@**freebsd.org<freebsd-questions-unsubscribe at freebsd.org>
>>>> "
>>>>
>>>>  ______________________________**_________________
>>> freebsd-questions at freebsd.org mailing list
>>> http://lists.freebsd.org/**mailman/listinfo/freebsd-**questions<http://lists.freebsd.org/mailman/listinfo/freebsd-questions>
>>> To unsubscribe, send any mail to "freebsd-questions-**
>>> unsubscribe at freebsd.org <freebsd-questions-unsubscribe at freebsd.org>"
>>>
>>
>> ______________________________**_________________
>> freebsd-questions at freebsd.org mailing list
>> http://lists.freebsd.org/**mailman/listinfo/freebsd-**questions<http://lists.freebsd.org/mailman/listinfo/freebsd-questions>
>> To unsubscribe, send any mail to "freebsd-questions-**
>> unsubscribe at freebsd.org <freebsd-questions-unsubscribe at freebsd.org>"
>>
>
>
>
> --
> regards,
> matt
>



-- 
regards,
matt


More information about the freebsd-questions mailing list