如何使用 bash 中的安装将目录复制到目录中?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19136297/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to copy directories into a directory using install in bash?
提问by mtsz
Assume the nested directories foo/bar
and a empty directory dest
.
I would like to call something like install foo dest
such that dest
contains the directory foo/bar
.
假设嵌套目录foo/bar
和空目录dest
。我想打电话给像install foo dest
这样dest
包含目录foo/bar
。
I have tried the following:
我尝试了以下方法:
install foo dest
=> install: omitting directory "foo"
install foo dest
=> 安装:省略目录“foo”
install -d foo dest
=> nothing happens
install -d foo dest
=> 什么也没发生
采纳答案by Paul Evans
You want to use cp -r
instead:
你想cp -r
改用:
cp -r foo dest
回答by Alberto Salvia Novella
install -D "${origin}"/* -t "${target}"