from urllib2 import urlopen
from bs4 import BeautifulSoup
webDir = 'https://indy.fulgan.com/SSL/'
localDir = 'c:\\webdl2\\'
urlpath =urlopen(webDir)
html = urlpath.read().decode('utf-8')
soup = BeautifulSoup(html,"html.parser")
links = soup.find_all('a')
filelist = []
for tag in links:
link = tag.get('href',None)
if link is not None and link.find('.zip') != -1:
#print link
filelist.append(link)
print('%d files to dl...' % len(filelist) )
for i, filename in enumerate(filelist):
remotefile = urlopen(webDir + filename)
localfile = open(localDir + filename,'wb')
localfile.write(remotefile.read())
localfile.close()
remotefile.close()
print('%d/%d' % (i , len(filelist)))
print('done')