[TriLUG] cp errror "Argument list too long"

Greg Brown gwbrown1 at gmail.com
Tue Jul 26 13:34:52 EDT 2005


Yeah, true.  I got everything to work using perl and mpeg2decode and
encode.  This is going to be rather processor intenstive, to say the
least!  But, alas, it will work.

Now if only I had a quad or 8-way machine to do this kind of work
with.  Or a Peintium Extreme, whever that comes out.  That should at
least make for a fairly decent desktop/video server machine without
having to worry about extra cooling, power, etc

Greg

On 7/26/05, William Sutton <william at trilug.org> wrote:
> it shouldn't....because it's ls'ing a directory not a bunch of files.  you
> can try this for yourself...
> 
> ls -1rt /path/to/your/full/directory
> 
> and should promptly see every file there scroll by.  If you decide to use
> the code, note the unlink() call.  Take it out if you want to keep the
> original files....or adapt the code to your purpose...this should be a
> decent start at what you want to do :)
> 
> --
> William Sutton
> 
> On Tue, 26 Jul 2005, Greg Brown wrote:
> 
> > Yeah, but wouldn't the ls called in your perl script still crap out
> > because of too many aruguments (files in the directory)?
> >
> > Greg
> >
> > On 7/26/05, William Sutton <william at trilug.org> wrote:
> > > 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
> > > >
> > > --
> > > TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> > > TriLUG Organizational FAQ  : http://trilug.org/faq/
> > > TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> > > TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc
> > >
> > --
> > TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> > TriLUG Organizational FAQ  : http://trilug.org/faq/
> > TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> > TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc
> >
> >
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc
>



More information about the TriLUG mailing list