[TriLUG] cp errror "Argument list too long"

Michael Tharp gxti at partiallystapled.com
Mon Jul 25 23:48:51 EDT 2005


William Sutton wrote:

>Maybe it's time to switch to Perl :)
>
>#-----
>my @file = map { chomp($_); $_; } `ls -1rt /path/to/files`;
>
>foreach my $file (@files)
>{
>    next unless -f "/path/to/files/$file";
>
>    `cp /path/to/file/$file /tmp/date`;
>    # your convert code here
>    # and, if you want, uncomment the next line
>    # unlink ("/path/to/files/$file");
>}
>  
>
The problem here is that he's not converting multiple
files ito multiple files, but rather multiple files into one
file, so I'm not sure this approach will help any. Perhaps
convert batches of as many files as will fit in one command
line, then seam the files together?

Michael Tharp



More information about the TriLUG mailing list