从一个目录复制文件到现有目录 [英] Copy files from one directory into an existing directory

查看:146
本文介绍了从一个目录复制文件到现有目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在bash中我需要做的是:

In bash I need to do this:


  1. 采取所有目录中的文件

  1. take all files in a directory

将它们复制到现有目录

我如何做到这一点?我试图 CP -r T1 T2 (在它既T1和T2现有目录,T1有文件),但它创建了一个名为T1 T2内的目录,我不希望这一点,我需要的文件在T1,直接往里走T2。我该怎么做呢?

How do I do this? I tried cp -r t1 t2 (both t1 and t2 are existing directories, t1 has files in it) but it created a directory called t1 inside t2, I don't want that, I need the files in t1 to go directly inside t2. How do I do this?

推荐答案

你想要的是:

cp -R t1/. t2/

在最后的点告知的内容拷贝当前目录,而不是目录本身。这种方法还包括隐藏文件和文件夹。

The dot at the end tells it to copy the contents of the current directory, not the directory itself. This method also includes hidden files and folders.

这篇关于从一个目录复制文件到现有目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆