Cool File & Directory Modules File::Path 23 of 69 : prev | index | next

File::Path

rmtree()

  use File::Path;
  rmtree(['foo/bar/baz', 'blurfl/quux'], 1, 1);
  rmtree('foo/bar/baz');

Arguments are:

  • the root of the subtree to delete, or a reference to a list of roots
  • a boolean value, which if TRUE will cause rmtree to print a message each time it examines a file, giving the name of the file, and indicating whether it's using rmdir or unlink to remove it, or that it's skipping it. (defaults to FALSE)
  • a boolean value, which if TRUE will cause rmtree to skip any files to which you do not have delete access (if running under VMS) or write access (if running under another OS). This will change in the future when a criterion for 'delete permission' under OSs other than VMS is settled. (defaults to FALSE)

The last two are optional.

  • returns the number of files successfully deleted.
  • Symlinks are simply deleted and not followed

© 2003 Barbie - barbie@missbarbell.co.uk contents http://birmingham.pm.org/