Code Comments
Programming Forum and web based access to our favorite programming groups.I have a program that is supposed to send files throw FTP. And I'm
using the Net::FTP. I have a destiny path and I need to create the
directories if they don't exist.
How do I check if a Directory exist?
Actual code +-:
sub fput($$$) {
my ($ftp, $orig, $dest) = @_;
return if $orig =~ /xpto/;
$dest = File::Spec->canonpath($dest);
if (-f $orig) {
my ($volume,$directories,$file) = File::Spec->splitpath($dest);
$ftp->mkdir($directories, 1) or print "Can't create directory:
", $ftp->message();
if ($ftp->put($orig, $dest)) {
print "file '$orig' sent.\n";
} else {
print "Can't put: ", $ftp->message();
}
} elsif (-d $orig) {
print "directory '$orig' not sent.\n";
} else {
die "Path '$orig' is not recognized\n".HELP;
}
}
Post Follow-up to this messageHy In the remote machine. I know how to create it, but I don't like to have a big error log. Eatch request creates log entraces, but if the directory already exists, creates also error logs. Marcos On Mon, 28 Mar 2005 19:08:32 +0200 (CEST), Steven Schubiger <steven@accognoscere.org> wrote: > On 28 Mar, marcos rebelo wrote: > > > Locally or remotely? > > > -e $dir for local purposes > > Steven >
Post Follow-up to this message> On 28 Mar, marcos rebelo wrote: > I have a program that is supposed to send files throw FTP. And I'm > using the Net::FTP. I have a destiny path and I need to create the > directories if they don't exist. Locally or remotely? > How do I check if a Directory exist? -e $dir for local purposes Steven
Post Follow-up to this messagemarcos rebelo wrote: > I have a program that is supposed to send files throw FTP. And I'm > using the Net::FTP. I have a destiny path and I need to create the > directories if they don't exist. > > How do I check if a Directory exist? If you can wait a couple days Net::FTP::File (http://search.cpan.org/~dmuey/) does this and more. The author is releasing soon and we've been using it to try it out for him, its pretty slick HTH Lee.M
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.