如何使用GNU cp命令将文件复制到多个目录 [英] How to copy a file to multiple directories using the gnu cp command
本文介绍了如何使用GNU cp命令将文件复制到多个目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能使用cp命令复制一个文件到多个目录?
Is it possible to copy a single file to multiple directories using the cp command ?
我尝试以下,没有工作:
I tried the following , which did not work:
cp file1 /foo/ /bar/
cp file1 {/foo/,/bar}
我知道这是可能使用for循环,或找到。但是使用GNU cp命令这可能吗?
I know it's possible using a for loop, or find. But is it possible using the gnu cp command?
推荐答案
没有, CP
可以复制多个来源,但只会复制到单个目标。您需要安排调用 CP
多次 - 每一次的目的地 - 你想要做什么;使用,就像你说的,一个循环或其他一些工具。
No, cp
can copy multiple sources but will only copy to a single destination. You need to arrange to invoke cp
multiple times - once per destination - for what you want to do; using, as you say, a loop or some other tool.
这篇关于如何使用GNU cp命令将文件复制到多个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文