For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > May 2006 > Create Directories









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Create Directories
SkyBlueshoes

2006-05-23, 3:58 am

Another stupid question, search.cpan.org doesn't like me, lol:

Which module is best for creating a directory and all directories in
between.

Ex:

I want to create the directory : \dir1\dir2\dir3\targetdirectory
but none of the preceding numbered directories exist...


Sky Blueshoes
Toby Stuart

2006-05-23, 3:58 am



> -----Original Message-----
> From: SkyBlueshoes [mailto:skyblueshoes@comcast.net]
> Sent: Tuesday, 23 May 2006 12:38 PM
> To: beginners@perl.org
> Subject: Create Directories
>=20
>=20
> Another stupid question, search.cpan.org doesn't like me, lol:
>=20
> Which module is best for creating a directory and all directories in=20
> between.
>=20
> Ex:
>=20
> I want to create the directory : \dir1\dir2\dir3\targetdirectory
> but none of the preceding numbered directories exist...
>=20
>=20
> Sky Blueshoes
>=20


use strict;
use warnings;

use File::Path;

eval { mkpath("c:\\a\\test\\path") };
if ($@)
{
print "Couldn't create: $@";
}
Anthony Ettinger

2006-05-23, 3:58 am

File::Spec if you are working cross platform.
then "mkdir $path"


On 5/22/06, Toby Stuart <toby.stuart@figtreesys.com.au> wrote:
>
>
>
> use strict;
> use warnings;
>
> use File::Path;
>
> eval { mkpath("c:\\a\\test\\path") };
> if ($@)
> {
> print "Couldn't create: $@";
> }
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>



--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html
Dr.Ruud

2006-05-23, 3:58 am

SkyBlueshoes schreef:

> Another stupid question, search.cpan.org doesn't like me, lol:
>
> Which module is best for creating a directory and all directories in
> between.
>
> Ex:
>
> I want to create the directory : \dir1\dir2\dir3\targetdirectory
> but none of the preceding numbered directories exist...


Also look into IO::All.

--
Affijn, Ruud

"Gewoon is een tijger."


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com