I'm trying to upload all files in a directory to s3 using dates in the filenames as parameters to create the s3 locations. Here's what I have so far.
for file in /home/ec2-user/clickparts/t*; do
year="${file:9:4}"
month="${file:14:2}"
day="${file:17:2}"
aws s3 cp "$file" s3://mybucket/json/clicks/clickpartition/$year/$month/$day/
done
Below is the output for the file "the_date=2017-05-04"
upload: ./the_date=2017-05-04 to s3://mybucket/json/clicks/clickpartition/-use//c/ic//the_date=2017-05-04
I want to put the file in
s3://mybucket/json/clicks/clickpartition/2017/05/04/the_date=2017-05-04