Computing.Net > Forums > Unix > multiple ftp files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

multiple ftp files

Reply to Message Icon

Name: Rachael Chow
Date: February 25, 2003 at 20:31:22 Pacific
OS: solaris
CPU/Ram: N/A
Comment:

I'm writing a ksh to select the files with criteria, i.e. with today date e.g. 'xxx20030225'., then multiple ftp these files to another host. How can I do that? Anyone know? Thanks a lot!




Sponsored Link
Ads by Google

Response Number 1
Name: WilliamRobertson
Date: February 26, 2003 at 07:43:13 Pacific
Reply:

Two approaches come to mind:

In ksh build up a variable containing all the filenames, then use that with an MPUT command in FTP, e.g:

list=*$(date +%Y%m%d).dat
print "Here's the list:"
for f in ${list}
do
print $f
done

ftp -i hostname <<-END
cd wherever
mput ${list}
bye
END

Or, use a co-process to set the ftp process running as a background resource, letting you have loops etc in ksh in the foreground and just talking to the ftp session when you need to using print -p and read -p. Very basic example (untested, will need more work):

ftp -i hostname |&

for f in xxx*.dat
do
print -p put $f
read -p result
done

print -p bye

The co-process solution may be overkill here but it can sometimes be a neat technique.


0
Reply to Message Icon

Related Posts

See More


Process name on AIX Restore takes long time i...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: multiple ftp files

Checking multiple .htpasswd files www.computing.net/answers/unix/checking-multiple-htpasswd-files/3652.html

FTP files in an interval www.computing.net/answers/unix/ftp-files-in-an-interval/5308.html

FTP File Size Problem from UNIX to www.computing.net/answers/unix/ftp-file-size-problem-from-unix-to/4240.html