in reply to Perl API that emulates mkdir -p on unix?
Here is somthing I wrote to do what you need.
#Note this is windows centric use strict; make_dir("c\:\\this\\is\\a\\deep\\subdirectory\\"); sub make_dir { my ($inpath) = @_; #Full directory path my $path = ""; #Storage path #Loop through the sections foreach(split/\\/,$inpath) { #Add to path $path .= $_ . "\\"; #Elimnate the drive and check to see if path exists if(!/\:/ and !-e $path) { #If not then make it mkdir $path; #Show status for demo print "Makeing $path\n"; } } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Perl API that emulates mkdir -p on unix?
by Anonymous Monk on Jun 20, 2012 at 18:23 UTC | |
by Anonymous Monk on Jan 29, 2014 at 14:59 UTC |