I need to allow new users do a daily ftp mget of many files with the same filename format, "*.zip". On the ftp site the download directory is /data/autouploaded.
While there are lots of ways to do this, I wanted to try doing it a shell script with the multi-fetching capabilities of the mac/linux ftp command or the curl command.
I can almost get the ftp command to work:
ftp ftp://user:password@ftp.mycompany.com/%2fdata/autoupload
but this says "No such file 'autouploaded" So add the trailing slash:
ftp ftp://user:password@ftp.mycompany.com/%2fdata/autoupload/
That just opens an interactive shell at the ftp site.
Well, how about adding the filenames as a glob at the end of the url? Nope. that tries to do an upload (put).
So, method 1. HOw do I say mget with the ftp command?
Alternately, I could use curl. Only, I can't find a word about mget with curl. The filenames are NOT sequential so the range feature in curl makes no sense.
Suggestions? Help?
Thanks.
A quick Google search gave me this link: Scripting FTP access
The quick summation is to use <<
to inject commands to the FTP client.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.