将文件夹的内容复制到另一个无效的文件夹中

时间:2014-03-20 20:26:50

标签: linux copy directory

希望社区可以帮助我完成这个命令。

我正在尝试备份httpd目录,如:

cp -avr /etc/httpd/ /etc/httpd_bk_march2014/

这将在httpd_bk_march2014中创建httpd的副本(httpd成为httpd_bk_march2014下的子目录)。但我只想直接在目标文件夹中复制httpd的内容(所以dest文件夹只保存来自httpd的内容)。

以下命令不起作用,引发错误:

#cd /etc
# cp -avr /httpd/. /httpd_bk_march2014/
cp: cannot stat `/httpd/.': No such file or directory
You have new mail in /var/spool/mail/root

这两个都没有:

# cp -avr /etc/httpd/* /etc/httpd_bk_march2014/
cp: target `/etc/httpd_bk_march2014/' is not a directory

只是想知道我在这里做错了什么。

非常感谢您的帮助!

0 个答案:

没有答案
相关问题