home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
perl_ste.zip
/
auto
/
Net
/
FTP
/
mkdir.al
< prev
next >
Wrap
Text File
|
1997-11-28
|
677b
|
38 lines
# NOTE: Derived from ./blib/lib/Net/FTP.pm. Changes made here will be lost.
package Net::FTP;
sub mkdir
{
@_ == 2 || @_ == 3 or croak 'usage: $ftp->mkdir( DIR [, RECURSE ] )';
my($ftp,$dir,$recurse) = @_;
$ftp->_MKD($dir) || $recurse or
return undef;
my $path = $dir;
unless($ftp->ok)
{
my @path = split(m#(?=/+)#, $dir);
$path = "";
while(@path)
{
$path .= shift @path;
$ftp->_MKD($path);
$path = $ftp->_extract_path($path);
# 521 means directory already exists
last
unless $ftp->ok || $ftp->code == 521 || $ftp->code == 550;
}
}
$ftp->_extract_path($path);
}
1;