我有一个目录
/Users/Xcode/DerivedData/
其中嵌套了另一个目录,该目录始终具有相同的前缀samePrefix-
,但后缀始终会更改,例如
/Users/Xcode/DerivedData/samePrefix-dpbrhituenmwbocbyjprfahsbiry
并且有一个文件要复制到当前工作目录
/Users/Xcode/DerivedData/samePrefix-dpbrhituenmwbocbyjprfahsbiry/myFile
所以我基本上希望一个命令可以复制myFile
,即使文件路径中按字母顺序排列的部分的路径更改了,所以我已经尝试过了
cp /Users/Xcode/DerivedData/samePrefix-*/myFile
不太确定该怎么做
答案 0 :(得分:0)
{
"name": "Updated with step",
"user_id": "231569461654",
"id": "5b75bc769b3143103cb787c2",
"workflow-steps": [],
"steps": [
"5b760fff24ccc23934fef240"
]
}
请注意伪造的目录/ Users / Xcode / DerivedData / samePrefix-fffffffffffffffffff /
因为您没有提到其他目录的名称。这是屏幕截图以及命令:
cp /Users/Xcode/DerivedData/*/myFile /Users/Xcode/DerivedData/samePrefix-f*
或者如果您希望在当前目录中使用它:
root@VIII:/Users/Xcode/DerivedData# ls
samePrefix-dpbrhituenmwbocbyjprfahsbiry samePrefix-fffffffffffffffff
root@VIII:/Users/Xcode/DerivedData# ls samePrefix-dpbrhituenmwbocbyjprfahsbiry/
myFile
root@VIII:/Users/Xcode/DerivedData# ls samePrefix-fffffffffffffffff/
root@VIII:/Users/Xcode/DerivedData# cd /
root@VIII:/# cp /Users/Xcode/DerivedData/*/myFile /Users/Xcode/DerivedData/samePrefix-f*
root@VIII:/# ls /Users/Xcode/DerivedData/samePrefix-fffffffffffffffff/
myFile