Prev

Perl Notes

Next

Chapter 9.7 Removing a Directory

Wether a file or directory can be accessed - by you, your script, or your visitors - depends on the directory's permissions. You can change a directory's permissions either from the prompt or from within your script, as described here.

To remove a directory:

  1. Type rmdir(.
  2. Type directory, where directory is the name (and path, if necessary) of the directory you wish to eliminate.
  3. Type ) to complete the function.
  4. Type ; to finsh the line.


if (-e "../tmp/tempdir") {
  rmdir("../tmp/tempdir") || @ErrorMessage;
  print "The directory has been removed.";
}

Tips


Prev Home Next