Linux下除了某个文件外的其他文件全部删除

字体大小: 中小 标准 ->行高大小: 标准

Linux下除了某个文件外的其他文件全部删除,最简单的方法是

# shopt -s extglob

# rm -fr !(file1)

Linux下除了某个文件外的其他文件全部删除

如果是多个要排除的,可以这样:

# rm -rf !(file1|file2)

Linux下除了某个文件外的其他文件全部删除

关于shopt请查看 http://www.linuxidc.com/Linux/2011-11/47686.htm

此文章由 http://www.ositren.com 收集整理 ,地址为: http://www.ositren.com/htmls/58659.html