in reply to Re: NET::ftp mkdir succeeds but then dies with 501?
in thread NET::ftp mkdir succeeds but then dies with 501?
Although still not obvious to me exactly where, it looks like code elsewhere was looping over the mkdir without being caught, so I rewrote, removing the eval/dies, which seems to behave as expected.$ftp->cwd($i2) or die "change directory $i2: ".$ftp->message." / ".$ft +p->code; my @nfiles = $ftp->dir; if(grep {$_ eq $i3} @nfiles){ die "make $i3: already exists"; } else { $ftp->mkdir($i3) or die "make directory ".$ftp->code; }
push @errs,"cannot change directory from $ftp->pwd to i2: $ftp->messag +e" unless $ftp->cwd($i2); my @nfiles = $ftp->dir; push @errs,"cannot list directory $ftp->pwd: $ftp->message" unless @nf +iles; push @errs,"directory $n2 already exists in $ftp->pwd: $ftp->message" +if grep {$_ eq $n2} @nfiles; push @errs,"cannot make directory $n2 in $ftp->pwd: $ftp->message $ftp +->code" unless $ftp->mkdir($n2); $ftp->quit; if(@errs){ print join "<br />",@errs; }
|
|---|