Objective
I wanted to download a list of files from an S3 bucket using python 3. I used a standard CSV in UTF-8 format. Here is an example CSV. It’s one column with just the filenames.
I could have built out the full
import csv
import wget
#open import file
with open("c:\\csv\\files-to-download.csv", newline='', encoding='utf-8') as f:
#Assign the import file to the DictReader "reader"
reader = csv.DictReader(f)
#Now loop through all rows and build out variables
for row in reader:
filename = row['name']
print('Beginning file download with wget module')
url = 'http://www.example.com/images/'
wget.download(url + filename, 'c:\\csv\\images\\' + filename)
Continue reading
Recent Comments