How to copy a file to multiple directories using the gnu cp command

前端 未结 22 2007
终归单人心
终归单人心 2020-12-02 03:25

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         


        
22条回答
  •  伪装坚强ぢ
    2020-12-02 04:24

    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.

提交回复
热议问题