首页 > 代码库 > Linux cp命令用法
Linux cp命令用法
[root@soon 20141011ntlib]# ls -al
total 16
drwxr-xr-x. 4 root root 4096 Oct 11 11:41 .
drwxrwxr-x. 22 bluesun bluesun 4096 Oct 11 11:41 ..
-rw-r--r--. 1 root root 0 Oct 11 11:41 1
drwxr-xr-x. 4 root root 4096 Oct 11 11:00 jsp
drwxr-xr-x. 3 root root 4096 Oct 11 11:00 WEB-INF
[root@soon 20141011ntlib]# pwd
/root/20141011ntlib
test是空文件夹
root@soon test]# pwd
/root/test
cp -r 20141011ntlib/ test/
[root@soon test]# ls -al
total 12
drwxr-xr-x. 3 root root 4096 Oct 11 11:45 .
drwxrwxr-x. 22 bluesun bluesun 4096 Oct 11 11:41 ..
drwxr-xr-x. 4 root root 4096 Oct 11 11:45 20141011ntlib
[root@soon ~]# cp -r 20141011ntlib/. test
[root@soon ~]# cd test
[root@soon test]# ls -al
total 16
drwxr-xr-x. 4 root root 4096 Oct 11 11:54 .
drwxrwxr-x. 22 bluesun bluesun 4096 Oct 11 11:41 ..
-rw-r--r--. 1 root root 0 Oct 11 11:54 1
drwxr-xr-x. 4 root root 4096 Oct 11 11:54 jsp
drwxr-xr-x. 3 root root 4096 Oct 11 11:54 WEB-INF
文件变动后,需要覆盖至test目录
[root@soon 20141011ntlib]# ls -lR
.:
total 4
-rw-r--r--. 1 root root 0 Oct 11 11:58 2
-rw-r--r--. 1 root root 0 Oct 11 11:58 3
drwxr-xr-x. 2 root root 4096 Oct 11 11:59 jsp
./jsp:
total 0
-rw-r--r--. 1 root root 0 Oct 11 11:59 abcdef.jsp
[root@soon ~]# cp -R 20141011ntlib/. test
[root@soon ~]# ls -lR test
test:
total 8
-rw-r--r--. 1 root root 0 Oct 11 12:02 1
-rw-r--r--. 1 root root 0 Oct 11 12:03 2
-rw-r--r--. 1 root root 0 Oct 11 12:03 3
drwxr-xr-x. 4 root root 4096 Oct 11 12:03 jsp
drwxr-xr-x. 3 root root 4096 Oct 11 12:02 WEB-INF
test/jsp:
total 16
-rw-r--r--. 1 root root 0 Oct 11 12:03 abcdef.jsp
drwxr-xr-x. 2 root root 4096 Oct 11 12:02 bookCatalogue
-rw-r--r--. 1 root root 7290 Oct 11 12:02 index.jsp
drwxr-xr-x. 2 root root 4096 Oct 11 12:02 web
[root@soon test]# rm -rf *
本文出自 “wawa” 博客,请务必保留此出处http://363340.blog.51cto.com/353340/1562474
Linux cp命令用法