perl + Net::FTP::Recursive

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perl + Net::FTP::Recursive
# 1  
Old 07-11-2003
perl + Net::FTP::Recursive

It will not advance to the next user in the list. It always dies right after it sends the 2/2 files from the first users dir.


sub ftp_out {
        print "SUB USER=$uname PASS=$pass HOST=$host\n";

        $ftp = Net::FTP::Recursive ->new("$host", Debug => 1) or die "HOST ERROR: ($@) ";
        $ftp->login("$uname","$pass") or die "UNAME/PASS ERROR: ",$ftp->message;
        $ftp->cwd("$FTP_OUT_DIR") or die "CWD ERROR: ",$ftp->message;
        $ftp->rput("${USER_DIR}/${uname}/*") or die "RPUT ERROR:",$ftp->message;

open (USERLIST, $USERLIST) || die "MIKE ERROR: ($!)";
foreach (<USERLIST>) {

foreach (@ULIST) {
        ($uname ,$pass ,$host)= split(/:/, $_);
	chdir ("$USER_DIR/$uname") || die "NO GO ($!)";
	ftp_out($uname ,$pass ,$host);

-- OUTPUT --
RPUT ERROR:ASCII data connection for test.synthium (,44879).
Transfer complete.
# 2  
Old 07-11-2003
is it me or am i not supposed to put the || dir blah blah after the rput line in the ftp sub.
# 3  
Old 07-11-2003
Well, this sample from looks basically the same as yours, except there's not "or die ..." parts, so maybe you could try temporarily removing them to see if it changes the behavior (in some positive way i hope Smilie). Also, you have "$ftp->quit;" commented out, so maybe the ftp session for the previous user is still active while the ftp session for the next user is attempting to be connected...

Although if it's not proceeding to the next user, wouldn't that suggest there's something wrong with the foreach loop and therefore (since the loop iterates at least once when it sends those 2 files) that perhaps the array @ULIST is not being populated the way you think it is? I am completely pulling at strings here, it's been awhile since I've messed with Perl...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unable to get the size of remote file using Net::FTP Perl Script

Hi, I am using below piece of code to get the size of the remote file. $ftp->cwd($destination) or $error=$ftp->message; if(!$error) { $ftp->put($file) or $error=$ftp->message; print "FTP size = \n"; ... (3 Replies)
Discussion started by: FarooqOnline
3 Replies

2. HP-UX

[Solved] Unable to rename file in ftp server .Net:FTP perl

Hello All, I am trying to connect to ftp server and get the files. Also i need to rename the file in other ftp dir. rename method is not allowing me to rename the file in other dir. When i tried copy command by using net::FTP:FILE then perl says it is not installed. Can some body help me to... (2 Replies)
Discussion started by: krsnadasa
2 Replies

3. UNIX for Dummies Questions & Answers

recursive search and ftp

Could someone help me in recursive search and ftp'ing the files to remote server? The host machine will have /dir1/dira/list_of_files1 /dir1/dirb/list_of_files2 /dir1/dirc/list_of_files3 . . . so., I need to search from dir1 recursively (only one level down) and find all the files that... (1 Reply)
Discussion started by: brahmi
1 Replies

4. Shell Programming and Scripting

NET::FTP Problem

I am facing some problem in the NET::FTP Library in perl script in the HPUX. I am using NET::FTP to ftp files from 23 remote servers. Except 1 server everything is working fine. I am getting this error from one server . but normal FTP is working fine for that server. everytime few files are ftped... (1 Reply)
Discussion started by: mohanm
1 Replies

5. Shell Programming and Scripting

Perl - Net::FTP issue

Wondering if anyone can help or advise on following issue. The below script should simply connect to a different server and retrieve certain files for me. use lib "/xxxxx/xxxxx/xxxxx/xxxx"; use Net::FTP; my $directory = "xxxxxxxx"; my $destinationDir = "xxxxxxxxx"; my $filePrefix =... (1 Reply)
Discussion started by: meevagh
1 Replies

6. Shell Programming and Scripting

Net::Ftp in perl

I am trying to execute a script in another server, i used Net::Ftp module How to execute unix command in another server by using Net::Ftp module.. #!/usr/bin.perl ### Perl script to $ftp->login($user_name,'password') or die "Cannot login ", $ftp->message;... (2 Replies)
Discussion started by:
2 Replies

7. Shell Programming and Scripting

Corrupted Download with Net::FTP (perl)

Hello, I am trying to download several files from a remote FTP server using Net::FTP from within a perl script. The files download alright, except they appear to be corrupted. I know this because once after downloading, I use bzcat to pipe the files to a split command, and bzcat complains saying... (3 Replies)
Discussion started by: amcrisan
3 Replies

8. Shell Programming and Scripting

Recursive FTP -- here at last.

Over the past few weeks, I saw a couple of threads requesting recursive ftp: Copying files between 2 Unix server ftp from NT to UNIX I decided to try to write a script to accommodate these requests. The result is HardFeed. Here are a few examples of what it can do. HardFeed ftpserver... (52 Replies)
Discussion started by: Perderabo
52 Replies

9. Shell Programming and Scripting

PERL: NET::FTP..>Debug Messages

HI All, NET::FTP->new($server, DEBUG=>1); I need to get all the Debug Messages in an array or a file.... Please suggest!! (0 Replies)
Discussion started by: angad.makkar
0 Replies

10. UNIX for Dummies Questions & Answers

Recursive FTP

I am trying to write a recursive FTP script and have come to a point where I need to test if the file is either a normal ascii file or a directory. My question is how do I test if the file is either ascii or directory. (1 Reply)
Discussion started by: aslamg
1 Replies
Login or Register to Ask a Question

Featured Tech Videos