[英]Linux how to use rm and exclude switch
I was wondering how we can use linux rm command with --exclude switch ?我想知道我们如何使用带有--exclude 开关的linux rm命令?
For example like grep has exclude function when searching over the files.例如,在搜索文件时, grep具有排除功能。
Here is one specific这是一个具体的
rm `find . -name "safe_room*" ! -name "safe_rooms.php"`
I used it mainly for git我主要将它用于 git
git rm `find . -name "safe_room*" ! -name "safe_rooms.php"`
Explanation:解释:
rm
- linux command for delete rm
- 用于删除的 linux 命令
`` - the signs used within mysql. `` - 在 mysql 中使用的标志。 on keyboard CTRL + 7
在键盘上 CTRL + 7
find . -name "safe_room*"
find . -name "safe_room*"
- find everything with safe_room* find . -name "safe_room*"
- 使用 safe_room* 查找所有内容
!
- NOT logical operator - 非逻辑运算符
-name "safe_rooms.php"
- exclude everything except safe_rooms.php -name "safe_rooms.php"
- 排除除了 safe_rooms.php 之外的所有内容
Hope this will help :)希望这会有所帮助:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.