René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
File::Path in perl | ||
Simulating mkdir -p
On some Unix systems, it's possible to create a multiple directories with a mkdir -p /aha/baby/caesar/domino call. This
would create /aha/baby/caesar/domino even if aha, or aha/baby or aha/baby/caesar didn't exist. Perl's equivalent is:
use File::Path; mkpath("aha/baby/caesar/domino"); Simulating rmdir
By the same token, it's also possible to simulate an rmdir
with File::Path.
use File::Path qw(rmtree); rmtree '/path/to/directory'; |