> Hi All,
> 
> I'm trying to slurp a directory of JPEG images.  The script is able to
read
> the directory but I can not get the files to open.  Anyone have any
> suggestions?
> 
> Thanks!
> 
> Brian 
> 
> Here is the output when I run the script:
> 
> Can't open images/.: No such file or directory at rezise~1.pl line 17.
> Can't do inplace edit: images/.. is not a regular file at rezise~1.pl line
> 17.

The above two are because you are getting '.' and '..' in the file list.

perldoc -f readdir

To see how to avoid this problem.

> Can't open images/L18078.jpg: No such file or directory at rezise~1.pl
line
> 17.
> Can't open images/L11373.jpg: No such file or directory at rezise~1.pl
line
> 17.
> Can't open images/L11374.jpg: No such file or directory at rezise~1.pl
line
> 17.
> Can't open images/L12883.jpg: No such file or directory at rezise~1.pl
line
> 17.
> Can't open images/L13129.jpg: No such file or directory at rezise~1.pl
line
> 17.
> Can't open images/L13178.jpg: No such file or directory at rezise~1.pl
line
> 17.
> Can't open images/L14311.jpg: No such file or directory at rezise~1.pl
line
> 17.
> Can't open images/L14448.jpg: No such file or directory at rezise~1.pl
line
> 17.
> Can't open images/L14533.jpg: No such file or directory at rezise~1.pl
line
> 17.
> Can't open images/L14627.jpg: No such file or directory at rezise~1.pl
line
> 17.
> Can't open images/L14715.jpg: No such file or directory at rezise~1.pl
line
> 17. 
> 
> ...and here is the script:
> 
> #!/user/local/bin/perl -w
> 
> use strict;
> use Image::Magick;
> 
> my $images = "C:/My Documents/images";
>     opendir (IMAGES, $images) or die "can not open $images: $!";
> 
> # load @ARGV for (<>)
> 
> @ARGV = map { "images/$_" } readdir IMAGES;  
> 

When you open your dir you use $images, but in the above map statement
you use 'images' (the string), that should probably be,

@ARGV = map { "$images/$_" } readdir IMAGES;

And since you are on Windows you might want to consider using 'catfile'
from File::Spec,

perldoc File::Spec

That should do it, if not come back...

http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to