使用查找和卷曲将目录内容上载到Sonatype Nexus存储库 [英] using find and curl to upload a directory contents to Sonatype Nexus repository
问题描述
我正在尝试使用curl通过bash将目录内容上载到nexus,而我正在使用的命令中存在一些问题
I’m trying to use curl to upload a the contents of a directory to nexus via bash and am having a few issues in the command I’m using
简而言之,我想在特定目录下执行find命令,并使用–exec {}操作来进行向内卷曲.
In short I want to do a find command on a specific directory and use the –exec {} action to do a curl to nexus
但是我的find命令返回的文件路径包括源目录,我想更改它,所以我只显示内容而不是完整路径
However my find command returns the file path including the source directory and I want to change this so I only show the contents not the full path
例如说我有一个名为trunk的目录,其中包含这些文件和子目录
e.g. say I have a directory called trunk which contains these files and sub directories
trunk/directory1/file1
trunk/directory2/file1
trunk/directory2/file2
我希望我的find命令返回
I want my find command to return
directory1/file1
directory2/file1
directory2/file2
然后可以将其传递给我的exec命令
then this can be passed to my exec command
我当前的查找命令是:-
my current find command is:-
find trunk -type f -exec curl --user user:pass --ftp-create-dirs -T {} https://PATH_TO_NEXUS/{} \;
工作正常,除了在Nexus中创建的文件是
this works ok except the files being created in nexus are
https://PATH_TO_NEXUS/trunk/directory1/file1
我想要的是
https://PATH_TO_NEXUS/directory1/file1
有人有什么主意吗?
推荐答案
从trunk
目录内部运行find
命令:
cd trunk
find . -type f -exec curl --user user:pass --ftp-create-dirs -T {} https://PATH_TO_NEXUS/{} \;
这篇关于使用查找和卷曲将目录内容上载到Sonatype Nexus存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!