cp !(file1|dir2) /data/ 复制文件到/data/,排除file1和dir2
mv !(file1|dir2) /data/ 移动文件到/data/,排除file1和dir2
rm -rf !(file1|dir2) ./ 删除当前目录下的文件,排除file1和dir2
------------------------------------------------------------------------------------------------------code
使用--exclude选项,格式与示例以下
格式:
tar -zcvf xxx.tar.gz dir --exclude=dir1 --exclude=file2
打包dir目录,排除dir1目录与file2文件
示例:
tar zcvf example.tar.gz ./ --exclude=test --exclude=test.txt
打包当前目录,排除test目录与test.txt文件
注意:
--exclude=dir 而不是 --exclude=dir/
--exclude=test.txt 而不是 --exclude test.txt
test