def getsamp(sample, experiment='', destination='./'): samp_url = get_urls.SAMPLE_BASE_URL + sample + '/' experiment_urls = [] if experiment: experiment_urls.append(samp_url + experiment + '/') else: for experimentdir in get_urls.get_subdirectories(samp_url): experiment_urls.append(samp_url + experimentdir + '/') fileurls = [] for experimenturl in experiment_urls: fileurls += [experimenturl + url for url in get_urls.filter_by_filetypes( get_urls.get_gz_urls(experimenturl))] print "You would download", len(fileurls), "files!" for filename in fileurls: print filename answer = '' while answer not in ['y', 'n', 'yes', 'no']: answer = raw_input('Should I continue? [y/n] ').lower() if answer in ['y', 'yes']: get_urls.download_files(fileurls, destination)
def listfiles(url): filenames = get_urls.get_gz_urls(url) for filename in filenames: print filename