How to upload entire directory to artifactory in Linux using curl or any shell script or any commandline utility in Linux?

I have tried to upload an entire directory to HTTP Repository but I am unable to do... I was able to do files inside that directory but I have no clue what to do.

Upvotes: 3

Views: 19091

Answers (5)

Sowmiya Ragu
Sowmiya Ragu

Reputation: 401

NOTE: The following solution applies to the Pro version. If applied to the free one, following error will be returned:

"errors" : [ {
    "status" : 400,
    "message" : "This REST API is available only in Artifactory Pro."
  } ]
}

If your folder stucture is a/b/c , then do a zip --> zip -r a.zip a/ Below command will explode the zip file with your folder structure and upload the files in target repository:

curl -u username:password \
     --header "X-Explode-Archive: true" \
     -X PUT "http://artifactory.com:8080/artifactory/my-repo/" \
     -T path/to/a.zip

Upvotes: 8

Amirhossein Taheri
Amirhossein Taheri

Reputation: 231

For adding recursively, you can use this command:

jf rt u --include-dirs=true dist/docs/html/(*) your-repository-name/{1}

Upvotes: 0

Keegan Cowle
Keegan Cowle

Reputation: 2479

A bit late to the party here but specifically for artifactory you can use the jfrog cli to do this: https://jfrog.com/help/r/artifactory-how-to-upload-a-folder-with-its-content-to-artifactory/via-jfrog-cli

the just of it is download the jfrog cli. set it up and then you can:

jf rt upload "/myFolder/*" repo --server-id=x

Upvotes: 0

Shivani Kothari
Shivani Kothari

Reputation: 74

You can try using below command:

curl -v -u admin:admin123 -T test.txt -X PUT http://192.168.xx.xx:8085/repository/testrepo/charts/

This will create charts folder inside testrepo repository and will put test.txt file inside charts folder.Note: Don't forget to place / after charts folder.

This is working for me.

Upvotes: 1

Ipor Sircer
Ipor Sircer

Reputation: 3141

for file in *;do
    <your working single file upload command executed with "$file" parameter>
done

Upvotes: 0

Related Questions