Rob Dixon wrote:
> "Kevin Zembower" wrote:
> > Rob, John, Bob, thanks for all your help and suggestions. I took Rob's suggestion
> > and copied all the contents onto my hard drive:
> >
> > [snip]
> >
> > Then, I edited, listed and ran the program:
> > [EMAIL PROTECTED]:~/RapheTask$ cat ./processAVimages.pl
> > #! /usr/bin/perl -w
> >
> > use strict;
> > use File::Find;
> >
> > sub process_file {
> > print "$File::Find::name\n";
> > #Other operations will go here
> > }
> >
> > find(\&process_file, '/home/kevinz/RapheTask/cd/');
> >
> > [EMAIL PROTECTED]:~/RapheTask$ ./processAVimages.pl
> > /home/kevinz/RapheTask/cd
> > /home/kevinz/RapheTask/cd/cdrom
> > /home/kevinz/RapheTask/cd/cdrom/PDF Docs
> > /home/kevinz/RapheTask/cd/cdrom/PDF Docs/PLUGA164.pdf
> > /home/kevinz/RapheTask/cd/cdrom/PDF Docs/PLUGA306.pdf
> > /home/kevinz/RapheTask/cd/cdrom/PDF Docs/PLUGA333.pdf
> > /home/kevinz/RapheTask/cd/cdrom/PDF Docs/PLUGA369.pdf
> > /home/kevinz/RapheTask/cd/cdrom/PDF Docs/PLUGA370.pdf
> > /home/kevinz/RapheTask/cd/cdrom/PDF Docs/PLUGA376.pdf
> > /home/kevinz/RapheTask/cd/cdrom/PDF Docs/PLUGA394.pdf
> > /home/kevinz/RapheTask/cd/cdrom/PDF Docs/PLUGA395.pdf
> > /home/kevinz/RapheTask/cd/cdrom/PDF Docs/PLUGA400.pdf
> > /home/kevinz/RapheTask/cd/cdrom/PDF Docs/PLUGA401.pdf
> > /home/kevinz/RapheTask/cd/cdrom/PDF Docs/PLUGA403.pdf
> > /home/kevinz/RapheTask/cd/cdrom/JPEG Covers
> > /home/kevinz/RapheTask/cd/cdrom/JPEG Covers/PLUGA164.jpg
> > /home/kevinz/RapheTask/cd/cdrom/JPEG Covers/PLUGA333.jpg
> > /home/kevinz/RapheTask/cd/cdrom/JPEG Covers/PLUGA376.jpg
> > /home/kevinz/RapheTask/cd/cdrom/JPEG Covers/PLUGA403.jpg
> > [EMAIL PROTECTED]:~/RapheTask$
> >
> > This is just the output expected and desired. Still don't know why this wouldn't
> > work
> > this way when reading straight from the CD-ROM. This is a local CD drive, on the
> > host,
> > and is not using Samba. But, I really appreciate the suggestions on a work-around
> > that
> > will let me continue to make progress on my project.
>
> I'm glad you got it going Kevin, but thats a huge amount of data to have to copy
> just to make the program work. If I were you I'd 'roll my own' with a recursive
> subroutine calling 'readdir'. It shouldn't be more than about a dozen lines of code.
It seemed like a neat little exercise, so I wrote this. See
if it works for you. I hope it helps.
Rob
use strict;
use warnings;
sub process_file {
my $name = shift;
print "$name\n";
#Other operations will go here
}
find(\&process_file, '/cdrom');
sub find {
my ($wanted, $dir) = @_;
my $dh;
opendir $dh, $dir;
while (my $file = readdir $dh) {
next if $file =~ /^\./;
my $filename = "$dir/$file";
if (-f $filename) {
&$wanted($filename);
}
elsif (-d _) {
find($wanted, $filename);
}
}
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]