File::Path#

Native implementation of File::Path

Provides directory tree creation and removal operations.

Synopsis#

use File::Path qw(make_path remove_tree);

make_path("foo/bar/baz", "quux/blort");
make_path("web/cgi", { mode => 0755 });

remove_tree("foo/bar", { keep_root => 1 });

# Legacy interface
use File::Path;
mkpath(["/tmp/a/b/c"], 0, 0755);
rmtree(["/tmp/scratch"]);

Functions#

make_path#

Create one or more directory trees, including intermediate directories (modern API). Accepts a list of paths and an optional trailing hashref of options (mode, error, verbose).

use File::Path 'make_path';
make_path("/tmp/a/b/c", { mode => 0755 });

mkpath#

Legacy interface for make_path. Accepts mkpath(\@dirs, $verbose, $mode).

use File::Path;
mkpath(["/tmp/a/b/c"], 0, 0755);

remove_tree#

Remove one or more directory trees recursively (modern API). Accepts a list of paths and an optional trailing hashref of options (keep_root, error).

use File::Path 'remove_tree';
remove_tree("/tmp/a", { keep_root => 1 });

rmtree#

Legacy interface for remove_tree. Accepts rmtree(\@dirs, $verbose, $safe).

use File::Path;
rmtree(["/tmp/a"]);

Perl equivalent: File::Path (make_path, remove_tree, mkpath, rmtree)