使用python下载给定文件目录的http url的文件的文件夹

时间:2010-10-19 10:25:43

标签: python download

  

可能重复:
  Looping through a directory on the web and displaying its contents (files and other directories) via Python

嗨,伙计们,

如果我有

下的代码文件

http://AAA/BBB/tags/revision/

如何在python中下载这些文件?

如果它们总共有600M,那么有一些有效的方法吗?

1 个答案:

答案 0 :(得分:0)

您使用svn作为存储库吗?它看起来像这样:

from subprocess import  Popen, PIPE

def svn_co(url):
    return run_program('svn', 'co', url)

def run_program(*args):
    popen_obj = Popen(args, stderr=PIPE)
    _, errors = popen_obj.communicate()
    if popen_obj.returncode:
        print errors

# This will get all the files in myproject's tagged version
# named tagname into the current directory
svn_co('http://svn.myserver.net/myproject/tags/tagname')