Solved

GETting and PUTting files from/to server via simple script

Posted on 1998-08-08
1
142 Views
Last Modified: 2010-03-05
I'm having trouble using the examples and help given by LWP and its related modules. I need to write a script to upload or download files to an FTP server. This script will be called by the CRON daemon. I also need to pass the username and password to the FTP server (and the username has a "/" character in it - NT server)
0
Comment
Question by:sportsinteractive
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
b2pi earned 50 total points
ID: 1209161
use Net::FTP;

$cx = Net::FTP->new("server.address");
$cx->login("UserNameOnServer", "Password") || die "Unable to login to server";
$cx->cwd("destination_directory") || die "Unable to cd to destination_directory";
$cx->put("source_file_on_local")  || die "put failed";
$cx->cwd("source_directory") || die "Unable to cd to source_directory";
$cx->get("source_file_on_server") || die "get failed"
$cx->quit;

if the username has a '/' character in it, it really shouldn't cause a problem, but you can always escape it via :

"username_with_a_\/_in_it"

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
syslog unix file 20 79
File Find regex problem 4 68
How to generate square thumbnail using perl 13 90
Perl regex to replace any capital letters not preceded by ">" 6 164
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question