title: Loop to assign variables to cut pieces of the filename then use in a command for each file in a dir
body: <p>I want to upload files into date partitioned s3 objects. I have a lot of files in the directory and want to move each file to the folder structure derived from the date in the filename.</p>
  
  <pre><code>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://bk-py-dev/json/clicks/clickpartition/$year/$month/$day/; done
  </code></pre>
  
  <p>It would be awesome if I could do it in this one-liner format. Filename is in format the_date=2019-03-05.json</p>