Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
508 views
in Technique[技术] by (71.8m points)

linux - 如何将包含文件的文件夹复制到Unix / Linux中的另一个文件夹? [关闭](How do I copy folder with files to another folder in Unix/Linux? [closed])

I am having some issues to copy a folder with files in that folder into another folder.

(我有一些问题要将包含该文件夹中文件的文件夹复制到另一个文件夹中。)

Command cp -r doesn't copy files in the folder.

(命令cp -r不会复制文件夹中的文件。)

  ask by user2080656 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The option you're looking for is -R .

(您正在寻找的选项是-R 。)

cp -R path_to_source path_to_destination/
  • If destination doesn't exist, it will be created.

    (如果destination不存在,则将创建它。)

  • -R means copy directories recursively .

    (-R表示copy directories recursively 。)

    You can also use -r since it's case-insensitive.

    (您也可以使用-r因为它不区分大小写。)

  • Note the nuances with adding the trailing / as per @muni764's comment .

    (请注意添加尾随/根据@ muni764的评论的细微差别。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...