Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to download 800 files from a server to my server. These files have different names and they're in different subdirectories in the remote server, but I have their names on a list. How can I do this on a way that I don't have to go one by one? I can use scp or sftp, but I don't know how to submit a list of files to be downloaded.

Thanks a lot!

share|improve this question

migrated from Apr 29 '13 at 20:41

This question came from our site for professional and enthusiast programmers.

What OS do you have on the server you want to download the files to? – Martin Prikryl Apr 29 '13 at 18:07
oops! sorry I forgot to mention, they're both Linux servers. – user2283859 Apr 29 '13 at 18:16
What programming language are you using? – zespri Apr 29 '13 at 20:34

You should be able to do something like:

wget $(< /the/list/of/files/here)

or even run the whole by a script that iterates over the files reading a line from the list and asking for it.

How much do you know of shell programming? How well do you know the command line Unix utilities? Are you familiar with a scripting language, like Perl or Python?

share|improve this answer

sftp has a -b option to read commands from a batch file. The batch file should contain a list of commands like you would type at the sftp> command prompt.

You could generate a batch file containing get commands for each file that you want to fetch, along with any other commands that you need to issue, like lcd or lmkdir to put the files in the correct local directories.

share|improve this answer

You must log in to answer this question.