cp/mv/etc : argument list too long ... I am sick of this

Giorgos Keramidas keramida at ceid.upatras.gr
Tue Dec 6 03:20:47 PST 2005


On 2005-12-05 17:56, user <user at dhp.com> wrote:
>
> Ok, so I have some big directories with lots of files.  If I do mv or cp,
> it always refuses, telling me:
>
> cp: argument list too long

I very often find that I want to move around huge trees, including
mostly source code, but compiled object code too.  One of the most
useful tricks for moving entire hierarchies is to use cpio(1):

    $ cd ~/branches/foo
    $ find . | cpio -p -dmvu ~/branches/bar

This is guaranteed to work with thousands of files, regardless of the
current shell, UNIX version or current per-process user limits :)

> - what is the number of files that is too many ? (err... arguments)
>
> - since I live in 2005, what can I do to my FreeBSD system to upgrade it
> to handle the directories I have ?  How do I fix this so I can do normal,
> simple command lines instead of butchered ridiculous hacks like above ?

Nothing.  The limits are there for a good reason.  To avoid letting a
rogue process that leaks memory like mad to bring the entire system to
a halt for lack of free memory :)



More information about the freebsd-questions mailing list