In a few words,
mkpath creates a directory, even if it's parent does not exist.
rmtree deletes a directory, even if it's not empty.
rmtree works like the unix commnd rm -r. It recursivly deletes children, not parents. In other words, it deletes a directory, whether it's empty or not. For example, using rmtree to delete /base/dir will delete /base/dir, /base/dir/a, /base/dir/a/1 and /base/dir/b.
I don't know of anything that does what you want with a single command.
And while we're talking about File::Path ... is the / following 'mkpath' and preceding 'foo' an error?
The leading slash makes it an absolute path. If you omit the leading slash, the path is relative to the current directory. Both are valid, but have different meanings.
In reply to Re: File::Path::rmtree: What am I not grokking?
by ikegami
in thread File::Path::rmtree: What am I not grokking?
by jkeenan1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |