IT Community - Software Programming, Web Development and Technical Support

How to connect FTP Server using Perl?

This is a discussion on How to connect FTP Server using Perl? within the Perl forums, part of the Software Development category; hi all, How to connect FTP Server using Perl?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > Perl

Register FAQ Members List Calendar Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 07-19-2007, 11:10 PM
raj raj is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
raj is on a distinguished road
Exclamation How to connect FTP Server using Perl?

hi all,


How to connect FTP Server using Perl?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-20-2007, 03:45 AM
Arun Arun is offline
D-Web Trainee
 
Join Date: Mar 2007
Posts: 43
Arun is on a distinguished road
Default Re: How to connect FTP Server using Perl?

#!/usr/bin/perl

use Net::FTP;

my host = ftp.yourftpserver.com
my $username = "yourusername";
my $password = "yourpassword";
my $ftpdir = "/your/ftp/path";
my $file = "yourfile";

#-- connect to ftp server
my $ftp = Net::FTP->new($host) or die "Error connecting to $host: $!";

#-- login
$ftp->login($username,$password) or die "Login failed: $!";

#-- chdir to $ftpdir
$ftp->cwd($ftpdir) or die "Can't go to $ftpdir: $!";

#-- download file
$ftp->get($file) or die "Can't get $file: $!";

#-- close ftp connection
$ftp->quit or die "Error closing ftp connection: $!";
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/perl/2262-how-connect-ftp-server-using-perl.html
Posted By For Type Date
Perl [Archive] - DiscussWeb IT Community - Technical Support and Technology Discussions This thread Refback 03-13-2008 02:20 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to connect C with DataBase? yuva C and C++ Programming 4 03-21-2008 09:35 PM
ERROR 2002 (HY000): Can't connect to local MySQL server through socket Gopisoft Database Support 1 10-29-2007 03:07 AM
How to set Perl Interpreter within perl script sivaramakrishnan Perl 1 07-19-2007 06:45 AM
How to connect MySQL from Perl script priyan Perl 2 07-12-2007 10:26 PM
problem when connect mysql for php Jeyaseelansarc PHP Programming 1 05-20-2007 10:39 PM


All times are GMT -7. The time now is 02:49 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0