Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
472 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 Answer

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的评论的细微差别。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...