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.
Asked
Active
Viewed 1.4k times
2
-
Can you use `rsync`? – Barmar Nov 08 '16 at 01:07
-
Can you show us what command you used to successfully upload a single file? That will help people to provide good answers starting from what you know. For example, if you are using `rsync`, then we can suggest the `-r` option, and mention `-a`, `-u` etc. – Toby Speight Nov 08 '16 at 13:31
-
Does this answer your question? [Uploading all of files in my local directory with curl](https://stackoverflow.com/questions/14019890/uploading-all-of-files-in-my-local-directory-with-curl) – Shihe Zhang May 06 '22 at 02:57
-
@ShiheZhang No, the other question is not about Artifactory and thus has less focused and specific answers than this one. – tripleee May 06 '22 at 06:26
5 Answers
8
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

Dipu
- 6,999
- 4
- 31
- 48

Sowmiya Ragu
- 361
- 4
- 5
1
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.

chintan thakar
- 1,440
- 1
- 15
- 25

Shivani Kothari
- 74
- 3
0
for file in *;do
<your working single file upload command executed with "$file" parameter>
done

Ipor Sircer
- 3,069
- 3
- 10
- 15
-
i just tried as below directories not uploading indeed only files inside it went to artifactory. – BharathKumarRaju Dasararaju Nov 08 '16 at 01:57
-
cd test inside it there is another directory test2 and two files a.txt and b.txt – BharathKumarRaju Dasararaju Nov 08 '16 at 01:59
-
for i in *;do;curl -T $i -u XXX:XXXX xyz.com/test;done – BharathKumarRaju Dasararaju Nov 08 '16 at 02:00
-
inside test2 both a.txt and b.txt uploaded but not test2 directory it self .... while running above command in console it thrown error as class java.net.SocketTimeout Exception eventhough it upoads two files namely a.txt and b.txt – BharathKumarRaju Dasararaju Nov 08 '16 at 02:03
-
3While this code snippet may solve the question, including an explanation [really helps](//meta.stackexchange.com/q/114762) to improve the quality of your post. Remember that you are answering the question for readers in the future, not just the person asking now! Please [edit] your answer to add explanation, and give an indication of what limitations and assumptions apply. In particular, you might want to say something about files whose names begin with `.`. – Toby Speight Nov 08 '16 at 13:30
-
**Flaggers / reviewers:** [For code-only answers such as this one, downvote, don't delete!](//meta.stackoverflow.com/a/260413/2747593) – Scott Weldon Nov 11 '16 at 00:14
0
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

testfile
- 2,145
- 1
- 12
- 31
0
For adding recursively, you can use this command:
jf rt u --include-dirs=true dist/docs/html/(*) your-repository-name/{1}

Amirhossein Taheri
- 103
- 1
- 8