开发者

download a folder of files given the http url of the files directory with python [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

Looping through a directory on the web and displaying its contents (files and other directories) via Python

hi, Guys,

If I have code files under

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

how can I download these files in python?

and If they have 600M in total, is there 开发者_Python百科some efficient way to do it?


Are you using svn as your repository? It would look like this:

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')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜