I've got a .bat file that will apply a few quick ImageMagick conversions across a large collection of subdirectories. I need to get this script to also push the output files to AWS S3 using the S3Express utility (Windows variant of S3cmd).
echo off
set dest=destination-bucket/testfolder/
for /D %%d in (*) do (
cd %%d
md small
convert %1 -resize 350x350 -quality 80 -strip ./small/image.jpg
md medium
convert %1 -resize 640x640 -quality 80 -strip ./medium/image.jpg
md large
convert %1 -resize 1080x1080 -quality 30 -strip ./large/image.jpg
md xlarge
convert %1 -resize 1440x1440 -quality 30 -strip ./xlarge/image.jpg
cd..
"C:\Program Files\S3Express\S3Express.exe"
put %%d %dest% -s -cacl:public-read -cond:"name matches 'image.jpg'"
REM -s == recursive (replicates subfolder structure)
REM -cacl == canned access control list (ACL) :: Everyone gets READ access
REM -cond == filter :: only pushes "image.jpg" files.
)
Named as "conv.bat", I would run this as "conv image.jpg".
The problem arises with "put", which is a S3Express command.
How can I get my script to plug the put command into S3Express at the end of each loop? In its current state, the script runs through the loop once, stopping after it opens 'S3Express.exe'.
It may or may not be relevant to note that this is my first batch script, and my first time using S3Express.