天天看点

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

继续阅读