3

I'm new to automation and Tried uploading entire folder structure to Artifactory repo with parent folder and child folders

structure is as below

test1 folder contains sub-folder: new_ref and it also contains sub-folder>>v1, new_data1 and it also contains sub-folder>>v1, v1 and it also contains sub-folder>>bl, memo

Tried using both --flat=true and false option:

jfrog.exe rt u --flat=false "F:/main/test1/" mr-local-generic/new_data/

On Artifactory its required to create folder name "new_data" and under that it should upload below folders with their respective child folders intact: new_ref, new_data1, v1, memo

But it creates folder name as new_data/F:/main/test1/ , how to resolve this any help is much appreciated.

Prostagma
  • 1,756
  • 9
  • 21
m.bharat
  • 33
  • 1
  • 4
  • 1
    The structure would be much clearer if you provided a model. The result of any of the listed commands [here](https://stackoverflow.com/questions/15214486/command-to-list-all-files-in-a-folder-as-well-as-sub-folders-in-windows) would be great. – Prostagma Oct 17 '19 at 15:53

1 Answers1

7

--flat=false keeps the system hierarchy. If you wish to upload without the path prefix, you have the following options:

  1. Run the upload command from the directory you wish to upload from, and use relative path with --flat=false:
cd /d F:\main\test1
jfrog.exe rt u --flat=false "./" mr-local-generic/new_data/
  1. Use Placeholders:

jfrog.exe rt u "F:/main/test1/(*)" mr-local-generic/new_data/{1}


To apply the source path pattern for directories as well as files, add the include-dirs flag.

For example:

jfrog.exe rt u --include-dirs=true "F:/main/test1/(*)" mr-local-generic/new_data/{1}

Prostagma
  • 1,756
  • 9
  • 21
  • 1
    Placeholder rocks,thank you for the solution!!! i was able to get the desired solution with it and also thru "--include" option. further i would like to know how placeholders /(*) in case of "F:/main/test1/(*)" help in achieving/manipulating to get the result. – m.bharat Oct 18 '19 at 04:53
  • "Any wildcard enclosed in parenthesis in the source path can be matched with a corresponding placeholder in the target path to determine the name of the artifact once uploaded." See more information and examples in the [Placeholders documentation](https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-UsingPlaceholders) – Prostagma Oct 22 '19 at 07:31