anchor.diff:      SET good=true
       IF "!arg!"=="" SET good=false
       IF "!arg:~0,1!"=="-" SET good=false
  -    IF !good!==true (SHIFT) ELSE (ECHO Error: --profile requires an argument 1>&2 & EXIT /B 2)
  +    IF !good!==true (SHIFT) ELSE (ECHO Error: --profile requires an argument >> "%ERROR_FILE%" & EXIT /B 1)
       SET profile=!arg!
       SHIFT
       GOTO loop
  
positive.code: 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%"
  
  :: Rethrow any error messages from the AWS API
  FOR /F %%i IN ("%ERROR_FILE%") DO SET size=%%~zi
  IF %size% GTR 0 (
      ECHO Creation failed with error message: 1>&2
      TYPE "%ERROR_FILE%" 1>&2
      DEL "%ERROR_FILE%"
      EXIT /B 1
  )
  DEL "%ERROR_FILE%"
  
  :: Store the new upload ID
  :: Remove double quotes, spaces, commas, and leading text from AWS response
  SET ID_FILE=upload-id.txt
  FINDSTR /C:"UploadId" "%RESPONSE_FILE%"> "%ID_FILE%"
  DEL "%RESPONSE_FILE%"
  SET /P uploadID= < "%ID_FILE%"
  DEL "%ID_FILE%"
  SET uploadID=%uploadID:"=%
  SET uploadID=%uploadID: =%
  SET uploadID=%uploadID:,=%
  SET uploadID=%uploadID:*:=%
  ECHO Creation succeeded with upload-id:
  ECHO    %uploadID%
  
  :: Unset local vars before exit
  SET RESPONSE_FILE=
  SET ERROR_FILE=
  SET ID_FILE=
  SET size=
  
  EXIT /B 0
  
  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  :: void uploadParts(string filedir)
  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  :uploadParts
  
  SETLOCAL EnableDelayedExpansion
  
  :: Count the number of file parts in the provided directory
  SET numFiles=0
  FOR %%F IN ("%filedir%\*.*.*") DO SET /A numFiles+=1
  
  :: Add initial lines to parts JSON file
  ECHO.
  
negative.code: 
  EXIT /B 0
  
  
  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  :: int validatePath(string filedir)
  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  :validatePath
  
  SETLOCAL EnableDelayedExpansion
  
  :: Make sure the provided path exists
  IF NOT EXIST %filedir% (
      ECHO Error: Could not find the path "%filedir%" >> "%ERROR_FILE%"
      EXIT /B 1
  )
  
  :: Make sure the provided path is a directory, not a file
  IF NOT EXIST "%filedir%\*" (
      ECHO Error: The provided path must be a directory. >> "%ERROR_FILE%"
      ECHO "%filedir%" is a file. >> "%ERROR_FILE%"
      EXIT /B 1
  )
  
  :: Get the number of files and object parts in the provided directory
  SET numFiles=0
  FOR %%f IN ("%filedir%\*") DO SET /A numFiles+=1
  
  SET numParts=0
  FOR %%F IN ("%filedir%\*") DO (
      SET ext=%%~xF
      SET ext=!ext:.=!
      SET nonNumeric=
      FOR /f "delims=0123456789" %%i IN ("!ext!") DO SET nonNumeric=%%i
      IF NOT DEFINED nonNumeric SET /A numParts+=1
  )
  
  :: Make sure that at least one object part was provided,
  :: and that object parts are the ONLY files in the directory
  IF %numFiles%==0 (
      ECHO No file parts were found in the provided directory. >> "%ERROR_FILE%"
      ECHO Parts are expected to be in the format "filename.ext.123" >> "%ERROR_FILE%"
      EXIT /B 1
  )
  IF NOT %numParts%==%numFiles% (
      >> "%ERROR_FILE%" (
          ECHO Error: Object parts must be the only files in this directory.
          ECHO    Object parts found in the provided directory: %numParts%
          ECHO    Total files found: %numFiles%
          ECHO Parts are expected to be in the format "filename.ext.123"
      )
      EXIT /B 1
  )
  
  EXIT /B 0
  
  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  :: int createMultipartUpload(string uploadIdFile, string bucket, string key, string options="", string profile)
  ::
  :: If successful, the upload-id of the new multipart upload will be stored to the provided file
  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  :createMultipartUpload
  
  SETLOCAL EnableDelayedExpansion
  
  SET uploadIdFile=%1
  SET createErrFile=createErr.txt
  
  :: Create the AWS S3 multipart upload (can't pass null string to --metadata argument)
  SET filedir=%filedir:"=%
  