Copy a list of files from a file
Something along these lines - the somecommand
depends on what you want to do - I don't get that from your question, sorry.
#!/bin/bash# Iterate through lines in filefor line in `cat file.txt`;do#your ftp command here do something somecommand $linedone
edit: If you really want to persue this route for multiple files (you shouldn't!), you can use the following command in place of somecommand $line
:
ncftpput -m -u username -p password ftp.server.com /remote/folder $line
ncftpput propably also takes an arbitrary number of files to upload in one go, but I havn't checked it. Notice that this approach will connect and disconnect for every single file!
Thanks for the very helpful example of how to feed a list of files to ftp. This worked beautifully for me.
After creating my ftp script in Linux (CentOs 5.5), I ran the script with:
ftp –n < ../script.ftp
My script (with names changed to protect the innocent) starts with:
open <ftpsite>user <userid> <passwd>cd <remote directory>binpromptget <file1>get <file2>
And ends with:
get <filen-1>get <filen>bye