天天看點

cp指令如何排除不想拷貝的子目錄

想使用CP拷貝一個大目錄(/home/study/test),但又不想拷貝其中的一個子目錄(/home/study/test/test1),應該如何寫指令行

方法:

1. cd /home/study/test

2. rsync -av --exclude  test1/ --exlclude test2/  ../test/  /home/copydir

以上,便可将/home/study/test目錄中,除test1和test2目錄外,其他所有的檔案和檔案夾copy到/home/copydir

參考:

http://bbs.chinaunix.net/thread-2077235-1-1.html

繼續閱讀