Argument List too Long

Carl T. Miller carl at carltm.com
Sun May 30 01:42:41 UTC 2010


Sanjay Chakraborty wrote:
> I have a script and that run every month, In the script it has a mv
> command and that moves about 35000 files from one directory to other
> directory. In one system it is working but in other system I am
> getting "Argument List too Long" error message.
>
> mv* ../$directory2/ cannot work.

Try this:

ls | while read file; do mv "$file" ../$directory2; done

c





More information about the redhat-list mailing list