using Net::FTP

I can get and put a file using Net::FTP if I know the name of the file. I need
to be able to open a directory and get all the files in it, without knowing
their names. Here is my code that 'almost' works.

$ftp->cwd("webshare:available:") or die "Can't cwd to webshare:available:";

my @items = $ftp->ls("webshare:available:");


foreach my $f(@items) {

		print "This file is named " . $f;
		print "\n";
		$ftp->get($f) or die "Can't get file.";	

	}



There are 2 files in the available directory. The loop runs through twice
printing, "This file is named  "

Then I get the error, "Can't get file."

It knows there are 2 files, but somehow does not read the name from $f. Can you
see what I am doing wrong?

Thanks so much,
Kathy Richmond
0
Katherine
7/8/2001 1:32:14 AM
perl.macperl 876 articles. 0 followers. Follow

2 Replies
450 Views

Similar Articles

[PageSpeed] 44

I figured out my problem. It works with $ftp->ls(). Default is the current
directory. I still don't know why the $ftp->ls("webshare:available:") doesn't
work.

-Kathy


--- Forwarded Message from Katherine Richmond ---

>Date: 07 Jul 2001 18:32:14 EDT
>From: Katherine Richmond
>Subject: using Net::FTP
>To: macperl@perl.org

I can get and put a file using Net::FTP if I know the name of the file. I need
to be able to open a directory and get all the files in it, without knowing
their names. Here is my code that 'almost' works.

$ftp->cwd("webshare:available:") or die "Can't cwd to webshare:available:";

my @items = $ftp->ls("webshare:available:");


foreach my $f(@items) {

		print "This file is named " . $f;
		print "\n";
		$ftp->get($f) or die "Can't get file.";	

	}



There are 2 files in the available directory. The loop runs through twice
printing, "This file is named  "

Then I get the error, "Can't get file."

It knows there are 2 files, but somehow does not read the name from $f. Can you
see what I am doing wrong?

Thanks so much,
Kathy Richmond
0
Katherine
7/9/2001 4:20:53 AM
On 08 Jul 2001 21:20:53 EDT, Katherine Richmond wrote:

>I figured out my problem. It works with $ftp->ls(). Default is the =
current
>directory. I still don't know why the $ftp->ls("webshare:available:") =
doesn't
>work.

By the look of it, I would think that FTP would follow the Unix
convention for file paths. So, use "/" not ":" as file path separator. I
guess.

--=20
	Bart.
0
bart
7/9/2001 12:42:14 PM
Reply:

Similar Artilces:

Re: [MacPerl] Re: using Net::FTP
--- Bart Lateur wrote: >I figured out my problem. It works with $ftp->ls(). Default is the current >directory. I still don't know why the $ftp->ls("webshare:available:") doesn't >work. By the look of it, I would think that FTP would follow the Unix convention for file paths. So, use "/" not ":" as file path separator. I guess. -- Bart. --- end of quote --- Great idea. I just tried, and it didn't work. Too bad. Should have worked. Thanks, Kathy ...

automatic FTP not using NET:FTP module
Hi, I have to automate ftp process using perl or shell scripts. At the moment I cannot install NET:FTP class. So any pointers for me on how do this. thanks, vas _______________________________________________________ Send a cool gift with your E-Card http://www.bluemountain.com/giftcenter/ On Wed, Jul 11, 2001 at 10:20:58AM -0700, srinivas.s@excite.com wrote: > I have to automate ftp process using perl or shell scripts. At the moment I > cannot install NET:FTP class. So any pointers for me on how do this. Why can't you install Net::FTP? Really, it&#...

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

FTP not using NET:FTP module ... Why dose this work???
Hi Using Luke Bakkens reply >If you can't install Net::FTP, the following works with the ftp.exe >program on NT to get the file /tmp/frazzle in binary mode: > >open FTP, "> tmpftp.$$"; >print FTP <<EOF; >$username >$password >bin >get /tmp/frazzle >bye >EOF >close FTP >system "ftp -s:tmpftp.$$ $hostname"; >unlink tmpftp.$$ > >on unix, the system call would be this i believe: >system "ftp $hostname < tmpftp.$$"; > >good luck >Luke I went and did the following, but ...

RE: ftp w/o using Net::FTP
James P Donnelly <jpd4@cisunix.unh.edu> asked: > I am only trying to login into a server, travese to the > correct directory, dump a file and quit. I have hacked > together something that gets me to the server and > then it seems to hang at the login.. Has anyone written > something like > this w/o use of the module? Any insight would be very helpful > > Thanks -- Jim > > > $cmd = 'rftp'; > $rftp_commands = > "open > $fHost > $user > $...

ftp folder using asp.net(vb.net)
 can i ftp a folder to a server using asp.net? anyone? thanks  Yes, you can use one of the Ftp components available, or just use the WebClient classhttp://www.windowsdevcenter.com/pub/a/windows/2006/12/12/building-ftp-services-using-net-20.html -- "Mark As Answer" if my reply helped you -- Yes, you can do it.  You actually just grab all the files out of the folder and send them up. See this: http://forums.asp.net/p/1288676/2483713.aspx Jason...

How to upload large files through FTP using Asp.net and VB.net
Hi, I want you to tell me that how can i upload the large files through FTP using asp.net and vb.net. I have developed a page where user can upload his/her file which is about 1-5 mb but if file size increase upto 50 mb then my page do not work. If i try so, then find the following error: The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request. Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log o...

How to use net use?
Please can any one tell me how to use the dos command net use properly? I have read the help but can't seem to get it to work. Keep getting sytax error message. Thanks in advance. "Beowulf" <who-knows@no-one.com> wrote in message news:9krutk$puu$1@news.grc.com... > Please can any one tell me how to use the dos command net use properly? > > I have read the help but can't seem to get it to work. Keep getting sytax > error message. what are you trying to do? There are about 50 options to "net use" that do a ton of different thin...

FTP using ASP.net
Hi, i am trying to implement an FTP applet using either ASP.NET or Javascript, can anyone tell me if ASP.NET has a limit on the size of file that can be uploaded ? Thanks Its controlled in the web.config file. Default is 4mbs....

using GET of NET::FTP
get ($remote,$local,$where) is failing whenever i use the third arguement. here in this case my file to be downloaded from FTP is of size 5MB. 2Mb of it is downloaded, now when i am executing the get ($remote,$local,$where) with $where as 2MB(2048), get method is returning me nothing and download is getting aborted. can anybody plz help me out to solve this problem. ...

using Net::Ping with MacPerl
hello, i would like to use the module Net::Ping with MacPerl. i've installed "cpan-mac-0.50" and dropped Net-Ping-2.02.tar.gz on the installme-program. in the folder "MacPerl �:site_perl:Net:" i now find a textfile "Ping.pm" along with lots of other perl-modules. All other ModuleFiles have a MacPerl icon, whil the file "Ping.pm" has the simple text icon. can i get it to work? does it need to be recompiled? thanks jochen ===== jochen hagenstroem jhagenstroem@mac.com __________________________________________________ Do Yo...

Net::Ftp use proxy?
When cpan goes to do a "get", it first says LWP not available, then tries NET::Ftp (which failes because it is behind a FW and needs to use ftp_proxy) and finally lynx. Lynx works (fortunately). Should Net:Ftp be able to use my "ftp_proxy" set in the environment? http is more robust over a proxy On Sat, 19 Feb 2005 14:33:03 -0800, Linda W <cygwin@tlinx.org> wrote: > > When cpan goes to do a "get", it first says LWP not available, > then tries NET::Ftp (which failes because it is behind > a FW and needs to use ftp_proxy...

Creating word document using asp.net using vb.net
Hello friends,  I want to create word document dynamically through asp.net using vb.net.Plz send me code for the same. Regrads , Harshala Lad.   To create Word document, you should use binary stream that contains correct format for Word. Then the key point is how do you get the source binary stream with proper format? I know there is a way to store Word documents in SQL as BLOB (binary Large object) and then read the binary stream from database, then write the stream into a Word document. You can take a look at this post: http://forums.asp.net/thread/1257206.aspxWe...

How to use winsock control in ASP.Net using VB.Net 2003?
I have to use winsock control in my ASP.net application. And don't have any idea to use it in ASP.net, but I have used it previously in VB.Net project. What I did in ASP.net  is-----I added its reference and also added it in toolbox. But it got added in Windows Forms section of toolbox. I dragged winsock control from tool box to a webform and named it as win1, then in code behind(i.e. aspx.vb) I tried to use it by typing win1 then one dot( . ) but it has not given any intellisence.So how could use winsock control in ASP.net.Can any send me link to a dummy project in which wins...

Web resources about - using Net::FTP - perl.macperl

Resources last updated: 1/19/2016 5:25:54 PM