- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: PERL script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2007 07:09 PM
тАО05-16-2007 07:09 PM
PERL script
i have tried transfering single files using the put command. But i m not able to use the mput command in PERL script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2007 07:16 PM
тАО05-16-2007 07:16 PM
Re: PERL script
There are two ways I would attack this problem.
1. Use the perl module Net::FTP which has lots of functions built about ftp'ing multiple files and indeed all te ftp functions possible as if on the command line.
2. I have in the past used "expect" scripts to automate actions that require user input such as ftp, scp etc.
Expect is simple to use and understand.
see http:://expect.nist.gov/
You can exven cheat a little and use autoexpect to macro record your actions on the command line and use as the basis of your script.
Regards,
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2007 07:43 PM
тАО05-16-2007 07:43 PM
Re: PERL script
Here's a working example, that will download all the contents (including subdirectories) of the /pub directory.
#!/usr/bin/perl
use Net::FTP::Recursive;
$ftp = Net::FTP::Recursive->new("
$ftp->login("username",'password');
#$ftp->cwd('/pub');
$ftp->rget( ParseSub => \&yoursub );
$ftp->quit;
sub yoursub {
$ftp->rget;
}
You will need to install this module on your machine (download it from:
http://search.cpan.org/~jdlee/Net-FTP-Recursive-2.00/), as it's not there by default.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2007 08:20 PM
тАО05-16-2007 08:20 PM
Re: PERL script
actually i dont want to get directories.
i want to put some directories with files inside.
i also didnt understand the line where u called the subroutine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-16-2007 10:19 PM
тАО05-16-2007 10:19 PM
Re: PERL script
run the following script and it will update those directories to the FTP.
#!/usr/bin/perl
use Net::FTP::Recursive;
$ftp = Net::FTP::Recursive->new("
$ftp->login("username",'password');
$ftp->rput( ParseSub => \&yoursub );
$ftp->quit;
sub yoursub {
$ftp->rput;
}
For more information read here:
http://search.cpan.org/~jdlee/Net-FTP-Recursive-2.00/Recursive.pm