Shell script to get all the files from FTP server

Methyl,

         I am trying to connect from HP UNIX version B.11.11 and target system is sun UNIX box and the version is Sun Microsystems Inc.   SunOS 5.9 .

here is the output for dir in ftp mode
ftp> dir
200 PORT command successful
150 Opening ASCII mode data connection for file list
226 Transfer complete

At present there are no files in the directory. but it will display all the files for dir command.

Thanks
Arun

---------- Post updated at 03:23 PM ---------- Previous update was at 03:18 PM ----------

remi,

I am getting invalid command for wget in ftp mode. here is result.

ftp> wget
?Invalid command

thx
arun

oh sorry

wget under the shell it s a stadalone programm

it handles HTTP and FTP

checkout man wget under your shell

regards

ps: there are risks that the server (ftp or http) diables "digging into it" ... but you can try :slight_smile: it s your right :slight_smile:

What is the output from the ftp "status" command while connected to the remote system.
Just type "status" at the ftp prompt.
We want to know the settings of the remote ftp server and whether they mentions globbing.

methyl,

here is the output for status command.

ftp> status
Connected to inetftp1.delphi.com.
No proxy connection.
Mode: stream; Type: binary; Form: non-print; Structure: file
Verbose: on; Bell: off; Prompting: on; Globbing: on
Store unique: off; Receive unique: off
Case: off; CR stripping: on
Ntrans: off
Nmap: off
Hash mark printing: off; Use of PORT cmds: on

thx
Arun

With "Globbing: on" we would expect globbing to work.

With a bit of googling it turns out that this is a known issue with SunOS 5.9 ftpd for which Sun issued a patch.

hi 1st thing u r doing wrong is after ftp login through the "<<" operator you r trying to execute some sort of code say for loop here which is beyond the ftp session scope.

Yep, this was pointed out in post #2. O/P recommended to use "mget" but there was a strange issue with globbing on the target Sun server.

With something like 'expect', you can make ftp do more complex things, like list files with ls and, capturing the list, move them one at a time with get/put, as if you were there yourself, but with less effort. My crude flavor of expect is:

(
 ## shell script that watches $ftp_log for progress and generates commands

) | ftp -v $host >$ftp_log 2>&1

Try:

wget -r ftp://username:password@server/path -A "*.txt"

I think we eliminated the Linux "wget" some many posts ago.
I quote:

Ignorance is no excuse in the Google age: Trustworthy wget binaries for hp-ux:
http://hpux.connect.org.uk/hppd/hpux/Gnu/wget-1.12/[](http://hpux.connect.org.uk/hppd/cgi-bin/search?package=on&description=on&term=wget&Search=Search)