Exporting list of files in an S3 bucket to a file


#1

I am looking to export the list of files in an S3 bucket to a file.

c3CSV(S3.listFiles(‘s3://c3–inbox-qa-XXXX/XX01/SAP_ScheduleAgreement/’,"-1")) produces a format that is not very easy to work with and may result in multiple files.

Is there an alternate way to do this?

Also is there a way to apply a filter?


#2

You can append .files to the function call so you only download the files property that is returned:

c3CSV(S3.listFiles(‘s3://c3–inbox-qa-XXXX/XX01/SAP_ScheduleAgreement/’,"-1").files)

#3

Re: filter - you can’t filter the listFiles call itself. You can either apply a filter in the browser by appending .filter(function(file){specify filter logic here}), or, since you’re already exporting this as CSV, just use Excel. :slight_smile: