Looking for command line ftp client (linux)
Question: I am looking to batch download a large number of files (>800). I have a text
file with the list of all the filenames. These filenames are then used to
derive the URL from which they can be downloaded. I had been parsing through
the file with a python script, using subprocess to wget the files.

    
    
    wget ftp://ftp.name.of.site/filename-prefix/filename/filename+suffix
    

However for reasons unknown to me, wget is failing to properly connect. I
wanted to know if I could essentially use an ftp program that would work in a
similar manner, i.e. no login and stay within the commandline.

Edit: What's in my text file:

    
    
    ERS032033
    ERS032214
    ERS032234
    ERS032223
    ERS032218
    

The ERS### act as the prefix. The whole thing is the filename. The final file
(i.e. filename+suffix) would look something like: ERS032033_1.fastq.gz

Submitting the correct url is not the problem.


Answer: Since you are using Python, I suggest dropping the subprocess approach and
using the `urllib` module instead:

    
    
    import urllib
    handle = urllib.urlopen('ftp://ftp.name.of.site/filename-prefix/filename/filename+suffix')
    print handle.read()
    handle.close()
    

Assuming you are using Python 2
([urllib.request](http://docs.python.org/3/library/urllib.request.html#module-
urllib.request) for Python 3)

If you simply need batch download,
[urllib.urlretrieve](http://docs.python.org/2/library/urllib.html#urllib.urlretrieve)
is a cleaner approach.

