Please see the module: File::Path

The mkpath function provides a convenient way to create directories, even if
your mkdir kernel call won't create more than one level of directory at a
time. mkpath takes three arguments:

the name of the path to create, or a reference to a list of paths to create,


a boolean value, which if TRUE will cause mkpath to print the name of each
directory as it is created (defaults to FALSE), and 

the numeric mode to use when creating the directories (defaults to 0777) 

It returns a list of all directories (including intermediates, determined
using the Unix '/' separator) created.


Howard A. Bullock
Global IT Infrastructure
717-810-3584


-----Original Message-----
From: John Deretich [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 25, 2003 12:30 PM
To: 'Patrick J. LoPresti'
Cc: Perl-Win32-Admin-Request (E-mail)
Subject: RE: s/ / / operator

Hi Patrick,

sorry I meant to say,
if I try to make a path
mkdir won't allow me to
do that.

Like for example,

$directory = "F:\this\is\a\test";

mkdir($directory,0777)
won't work.

Is there a make path function
in PERL? I cannot seem to find one.

thanks,

John

-----Original Message-----
From: Patrick J. LoPresti [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 25, 2003 9:26 AM
To: John Deretich
Cc: 'SUMNER, Peter'; Perl-Win32-Admin-Request (E-mail)
Subject: Re: s/ / / operator


To get the file name, use the File::Spec or File::Basename module.
They are more robust, portable, and readable than calling "split" by
hand.

Always invoke mkdir, or any similar Perl operator, like this:

  mkdir $directory, 0777
      or die "Unable to mkdir $directory: $^E";

That will tell you exactly what it tried to do and why it failed.

 - Pat


John Deretich <[EMAIL PROTECTED]> writes:

> Thanks Peter,
> 
> this works, but now PERL won't
> allow me to make the directory
> to copy the files in.
> 
> I am using mkdir("$directory",0777).
> 
> Any idea why?
> 
> thanks,
> 
> John
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to