Uploading multiple files using CURL

  1. You can cd/pushd to the appropriate directory so that the paths are just files. E.g. in a subshell so that the current directory in the main shell is not affected:

    (cd $TRAVIS_BUILD_DIR/dist; find *.tar <etc>)
    
  2. To upload everything in the same curl invocation, I constructed a comma-separated list in curly braces (which -T requires to upload multiple files) with a Perl script. For your case, that would be:

    (cd $TRAVIS_BUILD_DIR/dist;
    curl -T "$(perl -e 'print "{".join(",",@ARGV)."}"' *.tar)" <etc>)
    

Also note that .tars are uncompressed. You should probably pass -z/-j/-J to tar -c and/or change the extension to prevent confusion if you already do.

3 Likes