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

Re: [MacPerl] Rename Problem [Novice Question]



russell@cpp.critpath.org (Russell Johannesson)
>I know I must be missing something simple [...]

[...]

>$dir='Macintosh HD:Sample Folder:';
>print "$dir\n";
>opendir(FOLDER,"$dir") || die "I could not open this folder:";
>@files=readdir(FOLDER);

Something simple indeed: The paths returned by readdir() are relative
to $dir, not to the current directory. Insert a chdir($dir) and your code
will work.

Matthias

-----
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
  "And that's why I am going to turn this world upside down, and make
   of it a fire so *bright* that someone real will notice"
                                -- Vernor Vinge, _Tatja Grimm's World_