> >I want to run an image conversion program to rotate the contents of an >entire directory. > >This is run as thus: > > >"jpegtran -rotate 90 *.jpg" > > >The problem is that I need to specify the filename for each converted >image. Is there some command which 'takes' the value of the file for >each iteration?
You could read all the *.jpg files into an array,then you could loop through this array and get each one and handle it.For example: my $dir = '/your/files/path'; my @files = glob "$dir/*.jpg"; system "jpegtran -rotate 90 $_" for @files; If you have much of *.jpg files,then 'glob' is not fit for you.Then you could call 'readdir' to read each file from the directory.For example: opendir(HD,$dir) or die $!; while(my $file=readdir HD) { next unless $file=~/\.jpg$/; system "jpegtran -rotate 90 $file" } close HD Hope this helps. -- Jeff Pang NetEase AntiSpam Team http://corp.netease.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>