By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,278 Members | 1,566 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,278 IT Pros & Developers. It's quick & easy.

Need Help regarding FTP

P: 6
Hello,

I just started writing the script to connect to a virtual machine using ftp command in perl.
(I am having the Windows OS and the virtual machine has Linux)

The code is:

Line1: system("ftp 10.58.3.48");
Line2: system("ls -l");

But the problem is when I run this script from the command prompt, it executes Line1 and connects to the specified maching and then prompts for username and password which I enter manually. After entering username & password it doesnt continue executing Line2. It stops there.

I want this script only to enter the username and password. So what should I write in between Line1 & Line2 that will take the username and password and also execute the Line2(ie. the ls -l command) ?

Please help me for this.

Thanks.
Apr 23 '08 #1
Share this Question
Share on Google+
1 Reply


nithinpes
Expert 100+
P: 410
Hello,

I just started writing the script to connect to a virtual machine using ftp command in perl.
(I am having the Windows OS and the virtual machine has Linux)

The code is:

Line1: system("ftp 10.58.3.48");
Line2: system("ls -l");

But the problem is when I run this script from the command prompt, it executes Line1 and connects to the specified maching and then prompts for username and password which I enter manually. After entering username & password it doesnt continue executing Line2. It stops there.

I want this script only to enter the username and password. So what should I write in between Line1 & Line2 that will take the username and password and also execute the Line2(ie. the ls -l command) ?

Please help me for this.

Thanks.
You cannot achieve this using system() command. Make use of Net::FTP module.
You can see the usage and sample scripts for the module in CPAN if you follow the link.
Apr 23 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.