Skip to content

Instantly share code, notes, and snippets.

@sergiolucero
Created November 11, 2018 21:54
Show Gist options
  • Save sergiolucero/0d3fd07c4591bd91f330282ea15c6ebc to your computer and use it in GitHub Desktop.
Save sergiolucero/0d3fd07c4591bd91f330282ea15c6ebc to your computer and use it in GitHub Desktop.
download s3 files
import boto3
import os, sys
s3 = boto3.resource('s3')
def down(canal,token):
x = os.popen(f'lss3 matinales/audio/{canal}/|find "{token}"').read()
files=[f for f in x.split() if 'mp3' in f]
print(files)
for f in files:
g=f.split('/')[-1]
print(f,g)
s3.Bucket('matinales').download_file(f,g)
if __name__ == '__main__':
canal, token = sys.argv[1:]
down(canal, token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment