At Tuesday 29/8/2006 03:55, alper soyler wrote:
I am trying to get some files from an ftp site by ftplib module and
I wrote the below script. However I have a problem. With my script,
I login to ftp.genome.jp site. then, I am changing the directory to
pub/kegg/genomes/afm and I am downloading "a.fumigatus.pep" file.
However, what I want is to connect pub/kegg/genomes directory and in
this directory there are 3 letters name files
3 letters *files*? or 3 letters *directories*?
e.g. 'afm' and in each of these 3 letters files there is a file with
the extension of '.pep' like a.fumigatus.pep. I want to get these
'.pep' files from the 3 letter named files. If you help me I will be
very glad. Thanks you in advance.
Do a cwd() starting one level above (that is, pub/kegg/genomes);
using ftp.dir() you can get the subdirectories, then iterate over all
of them, using another dir() to find the .pep files needed.
directory = 'pub/kegg/genomes/ afm'
Is that whitespace intentional?
(If you just want to download the files and don't need really a
Python script, try wget...)
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
--
http://mail.python.org/mailman/listinfo/python-list