anchor.diff:  
   :: Create the AWS S3 multipart upload (can't pass null string to --metadata argument)
   SET filedir=%filedir:"=%
  -ECHO Creating multipart upload for "%filedir%" to %key% in bucket %bucket%...
   SET options=%options:"=%
  +ECHO.
  +ECHO Creating multipart upload with options:
  +ECHO    Bucket: %bucket%
  +ECHO    Key: %key%
   IF NOT "%options%"=="" ECHO    Options: %options%
   SET RESPONSE_FILE=response.txt
   SET ERROR_FILE=error.txt
  -aws s3api create-multipart-upload --bucket "%bucket%" --key "%key%" %options% --profile "%profile%"> "%RESPONSE_FILE%" 2> "%ERROR_FILE%"
  +aws s3api create-multipart-upload --bucket %bucket% --key %key% %options% --profile %profile%> "%RESPONSE_FILE%" 2> "%ERROR_FILE%"
   
   :: Rethrow any error messages from the AWS API
   FOR /F %%i IN ("%ERROR_FILE%") DO SET size=%%~zi
  
positive.code: FOR %%F IN ("%filedir%\*.*.*") DO (
      :: Display progress
      SET /A counter+=1
      ECHO Uploading part !counter!/%numFiles%: %%F
      
      :: Get the ETag for this object part =%
      : Trim leading spaces and remove escpaed quotes =%
      echo uploadID: %uploadID%
      aws s3api upload-part --bucket "%bucket%" --key "%key%" --part-number !counter! --body %%F --upload-id %uploadID% --profile "%profile%" | findstr ETag> "%TMP_FILE%"
      SET /P etag= < "%TMP_FILE%"
      SET etag=!etag: =!
      SET etag=!etag::=: !
      SET etag=!etag:\"="!
      
      :: Export the JSON block for this part
       : Makes sure there's no comma after the last one!
      IF !counter!==%numFiles% (SET closeBrace=}) ELSE (SET closeBrace=},)
      >> %ETAGS_FILE% (
          ECHO        {
          ECHO            !etag!,
          ECHO            "PartNumber": !counter!
  
negative.code: IF ERRORLEVEL 1 EXIT /B 1
  
  :: Upload each part
  SET ETAGS_JSON=%CD%\upload-part-etags.json
  CALL :uploadParts
  
  :: Complete the multipart upload
  CALL :completeMultipartUpload
  REM DEL "%ETAGS_JSON%"
  
  EXIT /B 0
  
  