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 *

 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章