We don't bite newbies here... much | |
PerlMonks |
Re^2: Net::FTP failureby wow_za_ (Initiate) |
on Jul 06, 2008 at 21:46 UTC ( [id://695876]=note: print w/replies, xml ) | Need Help?? |
Below is the output, followed by the script when it is run.
Name "main::path2" used only once: possible typo at transfer.pl line 38. Net::FTP>>> Net::FTP(2.75) Net::FTP>>> Exporter(5.58) Net::FTP>>> Net::Cmd(2.26) Net::FTP>>> IO::Socket::INET(1.27) Net::FTP>>> IO::Socket(1.28) Net::FTP>>> IO::Handle(1.24) Net::FTP=GLOB(0x180bc60)<<< 220 unixs1.cis.pitt.edu FTP server ready. Connected! Net::FTP=GLOB(0x180bc60)>>> user mcs2 Net::FTP=GLOB(0x180bc60)<<< 331 Password required for mcs2. Net::FTP=GLOB(0x180bc60)>>> PASS .... Net::FTP=GLOB(0x180bc60)<<< 230 User mcs2 logged in. Login successful Net::FTP=GLOB(0x180bc60)>>> CWD ./public/html/ Net::FTP=GLOB(0x180bc60)<<< 250 CWD command successful. Net::FTP=GLOB(0x180bc60)>>> PWD Net::FTP=GLOB(0x180bc60)<<< 257 "/afs/pitt.edu/home/m/c/mcs2/public/html" is current directory. pwd = /afs/pitt.edu/home/m/c/mcs2/public/html Net::FTP=GLOB(0x180bc60)>>> HELP PUT Net::FTP=GLOB(0x180bc60)<<< 502 Unknown command PUT. Supported = 0 Net::FTP=GLOB(0x180bc60)>>> PORT 10,0,1,196,207,163 Net::FTP=GLOB(0x180bc60)<<< 502 Illegal PORT Command Could not send file! ################################################# #!/usr/bin/perl -w #this library is needed for the transfer use Net::FTP; #declares your host and creates your ftp object $host='unixs.cis.pitt.edu'; $ftp=Net::FTP->new($host,Timeout=>240,Debug=>1,Passive=>0, Port=>21) or die "Could not create FTP object!\n\n"; print "Connected!\n"; #THIS IS THE LOGIN SECTION, REPLACE $uname AND $pwd WITH EITHER A USERNAME # AND PASSWORD, OR DEFINE THE VARIABLES YOURSELF IN THE LINES BEFORE ($uname, $pwd) = get_info(); $ftp->login($uname,$pwd) or die "Cannot login to $host!\n\n"; print "Login successful\n"; #this line will change to whichever directory you need $dir = "./public/html/"; $ftp->cwd($dir) or die "Unable to switch directories!\n\n"; $pwd = $ftp->pwd(); print "pwd = $pwd\n"; $test = $ftp->supported("put"); print "Supported = $test\n"; #@files = $ftp->dir(); #print "Files = $files[0]\n"; #uploads the file, absolute path names required. #path1 is the file path, path2 is the location on the remote host $path1 = "test.html"; $path2 = "./test.html"; #$path2 = "/afs/pitt.edu/home/m/c/mcs2/public/html/test.html"; $ftp->stor($path1) or die "Could not send file!\n\n"; print "File transferred!\n"; #quits the connection $ftp->quit or die "Unable to close the connection?\n\n"; print "Finished!\n"; exit(0);
In Section
Seekers of Perl Wisdom
|
|