[TriLUG] cp errror "Argument list too long"
William Sutton
william at trilug.org
Tue Jul 26 11:54:10 EDT 2005
It's not entirely hopeless...I tried the following and it appears to
work...
I created 4 .jpg files named 1.jpg through 4.jpg, containing the
equivalent number. I then executed the following commands in sequence:
touch num.mpeg
convert -delay 0 num.mpeg 1.jpg num.mpeg
convert -delay 0 num.mpeg 2.jpg num.mpeg
convert -delay 0 num.mpeg 3.jpg num.mpeg
convert -delay 0 num.mpeg 4.jpg num.mpeg
convert -delay 0 num.mpeg 1.jpg num.mpeg
convert -delay 0 num.mpeg 2.jpg num.mpeg
convert -delay 0 num.mpeg 3.jpg num.mpeg
convert -delay 0 num.mpeg 4.jpg num.mpeg
convert -delay 20 num.mpeg num.mpeg
You can see the files at http://trilug.org/~william/convert
basically I think this can be made to work as I indicated below...see
revised code:
#!/usr/bin/perl
#-----
use strict;
my $convert = `which convert`;
chomp($convert);
# change to suit your needs
my $input_dir = "/home/william/convert";
my $output_dir = "/home/william/public_html/convert";
my $frame_delay = 20;
my $output_file = "output.mpeg";
my @input_files = map { chomp($_); $_; } `/bin/ls $input_dir`;
foreach my $file (@input_files)
{
`mv $input_dir/$file $output_dir`;
`$convert -delay 0 $output_dir/$output_file $output_dir/$file \
$output_dir/$output_file`;
unlink("$output_dir/$file");
}
`$convert -delay $frame_delay $output_dir/$output_file \
$output_dir/$output_file`;
#-----
to join multiple mpeg files, I think you should be able to do the
following:
convert -delay 0 *.mpeg out.mpeg
HTH!
William Sutton
On Mon, 25 Jul 2005, Michael Tharp wrote:
> 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