Reputation: 895
I want to create a directory with current date as the directory name and move files created on my local file system into this new directory.
The goal is to transfer files created everyday in local system into S3 with current date as directory name.
aws s3 cp --recursive "local_folder" s3://bucket/directory/
How can I add the current date to the directory name?
Upvotes: 2
Views: 8445
Reputation: 736
For me the one which worked is below
aws s3 cp filename s3://bucketName/data/date=$(date '+%Y-%m-%d')/
Upvotes: 0
Reputation: 21
If you are going to use a script, I'd prefer to do:
DATE=$(date '+%Y%m%d')
BUCKET="bucket-name"
aws s3 cp --recursive "local_folder" s3://${BUCKET}/${DATE}
Upvotes: 2
Reputation: 269931
You could use a script like:
DATE=`date '+%Y-%m-%d'`
echo aws s3 cp --recursive "local_folder" s3://bucket/$DATE/
Upvotes: 1