Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Create unexistent directories by FTP
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;
}
}

Report this thread to moderator Post Follow-up to this message
Old Post
Marcos Rebelo
03-28-05 08:56 PM


Re: Create unexistent directories by FTP
Hy

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
>

Report this thread to moderator Post Follow-up to this message
Old Post
Marcos Rebelo
03-28-05 08:56 PM


Re: Create unexistent directories by FTP
> 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

Report this thread to moderator Post Follow-up to this message
Old Post
Steven Schubiger
03-29-05 01:56 AM


Re: Create unexistent directories by FTP

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.
>
> 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

Report this thread to moderator Post Follow-up to this message
Old Post
JupiterHost.Net
03-29-05 01:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:55 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.