Piyush Patil
Piyush Patil

Reputation: 14523

How do I move files whose name changes daily to AWS S3 bucket using AWS CLI?

I have script that runs daily and saves a CSV file with daily time stamp below is the AWS CLI command for moving a file to S3 bucket and then delete it from source I am using.

aws s3 mv /path/NW_test_Export_03_05_2020_14_37_24.csv s3://bucekt-name/folder/ --acl public-read-write

I want to automate this daily moving of file to S3 bucket using a Cron job. How do I make the file name variable in the AWS CLI command?

Upvotes: 0

Views: 543

Answers (1)

Piyush Patil
Piyush Patil

Reputation: 14523

Ok by trial and error the below command is working perfectly for me.

aws s3 mv /path-to-file/ s3://bucekt-name/folder/ --exclude "*" --include "*.csv" --recursive

Upvotes: 1

Related Questions