Solved

GETting and PUTting files from/to server via simple script

Posted on 1998-08-08
1
138 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
1 Comment
 
LVL 5

Accepted Solution

by:
b2pi earned 50 total points
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now