您的位置:首页 > 运维架构 > Shell

Unix/Linux Shell: 除 "*.sh"后缀名以外,删除的当前所有文件和文件夹

2013-12-16 01:35 344 查看
In the current directory, how do we delete all the files and folders that do not end with ".sh" 

WARNING: This command will delete the NON-EMPTY folders.  Use it with scrutiny! 

find . -maxdepth 1  \( ! -iname '*.sh' ! -iname '.' \) -exec rm -r {} \;

#be careful about the empty spaces in the command
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐