[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] reading pc formated floppies



doug spore wrote:
> 
> The script below, when saved as a droplet, prints a mac folder's complete
> path then lists the files the folder contains. When I drop a PC formated
> disk (not my idea, but the government's) containing text files, on the
> droplet it prints the disks name but the gives me error #002, when the
> script tries to list the files the disk contains. What am I doing wrong?
> Any help is greatly appreciated.
> 
> #!/usr/bin/perl -w
> 
> $folder_name = "@ARGV";
> print "$folder_name\n";
> 
> opendir(FOLDER,$folder_name) || die "Could not open $folder_name: $!";
> @allfiles = readdir(FOLDER);
> 
> foreach $file (@allfiles){
>     print "$file\n";
> }
> 
> Again THANKS for the help!
> 
> Doug Spore

The problem is the colon at the end of the folder name. There shouldn't be 
one. So delete it:

        $folder_name =~ s/:$//;
 
BTW the same problem occurs whenever you drop a disk onto the droplet, not 
just for PC disks.

-- 
                Bart Lateur
                Gent (Ghent, Gand), Belgium,
                Europe,
                3rd planet from the sun.