FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old January 30th, 2004, 01:14 PM
btikeda btikeda is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: San Francisco, CA
Posts: 1 btikeda User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Net::FTP - get() and dir() fail

I have been using FTP to move files to a remote site manually and since the number of files has been growing, I thought I would write a PERL script to make my life easier.

I'm on an Windows XP machine. My script connects to the remote host, logs in, and changes directories just fine - however it fails trying to do a "dir", "get" or "put". Here's the part that works:

Code:
    $ftp = Net::FTP->new($target) or die "Cannot Connect ", $! ;
    $ftp->login($usr,$pwd) or die "Cannot Login ", $! ;
    $ftp->cwd($tdir) or die "Cannot change directory", $! ;


Then I tried the following:
Code:
    @rdir = $ftp->dir() or die "Cannot do Dir - ", $! ;


and recieved the following error message
Quote:
Cannot do Dir - Bad file descriptor at C:\...\ftp4.pl line 23.


So I tried to get a file that I knew was in that directory, and I included calls to mdtm and size to make sure that everything was where I expected:
Code:
    $mdate = $ftp->mdtm("index.html") or die "Cannot get mod date - ", $! ;
    $isize	= $ftp->size("index.html") or die "Cannot get size - ", $! ;

    print "\nIndex.html " ;
    print "\n  size : $isize" ;
    print "\n  mod  : $mdate" ;
    print "\n\n" ;
	
    $rfil = $ftp->get("index.html","getindex.html") or die "cannot get file - ", $! ;


and I got the following
Quote:
Index.html
size : 221
mod : 1075246992

cannot get file - Bad file descriptor at C:\...\ftp4.pl line 35.


I'm at a loss as to how come I can manually FTP, I can use Net::FTP to connect and login to the remote server - but I can't seem to do anything useful like "get" or "dir"?

Thanks in advance for any help.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > Net::FTP - get() and dir() fail


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway