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

Re: [MacPerl] erase file MacPerl5



Pierre Cottin <pcottin@phy.ulaval.ca> writes:
}Hi,
}
}I would like to know the command to erase a file our a folder with MacPerl
}5. With MacPerl 4, rmdir worked but now, it doesn't work anymore.

If rmdir worked on plain files, either Perl 4 or MacPerl 4 was broken.

To remove a single file, use unlink("path:to:file")  (the name isn't
supposed to be obvious, it comes from the C library call of the same name).
Once a folder (directory in Unixspeak) is empty, you can use
rmdir("path:to:folder:") on it, but this should fail if the folder isn't
empty.  If you want to remove an entire tree, there's File::Path::rmtree(),
but of course, this should be used with caution, since it will remove all
files and all subfolders in the folder you tell it to get rid of.

}
}Thank you
}
}
}Pierre Cottin
}Centre d'Optique, Photonique et Laser
}Universite Laval, Pavillon Vachon
}Quebec, PQ
}G1K 7P4 CANADA
}
}Tel. (1) 418-656-2131 ext. 6187
}Fax. (1) 418-656-2623
}email. pcottin@phy.ulaval.ca


---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us