Linux如何使用rm和exclude开关

标签 linux ubuntu switch-statement rm

我想知道我们如何使用带有 --exclude 开关 的 linux rm 命令?

例如grep在搜索文件时有排除功能。

最佳答案

这是一个具体的

rm `find . -name "safe_room*" ! -name "safe_rooms.php"`

我主要用于git

git rm `find . -name "safe_room*" ! -name "safe_rooms.php"`

解释:

rm - 用于删除的 linux 命令

`` - mysql 内部使用的标志。在键盘上 CTRL + 7

找到 . -name "safe_room*" - 使用 safe_room* 查找所有内容

! - 非逻辑运算符

-name "safe_rooms.php" - 排除除 safe_rooms.php 之外的所有内容

希望这会有所帮助:)

关于Linux如何使用rm和exclude开关,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16213432/

相关文章:

java - 如何修复操作 switch 语句

javascript - 如何下载包含javascript代码查找结果的网站?

linux - 编写跨 linux 风格的通用脚本

c++ - 限制用户输入

c++ - Linux 上的 Lua C++ 开发文件 (/usr/bin/ld : cannot find -llua5. 1)

php - 从 PHP 版本字符串中删除 ubuntu

javascript - javascript中的切换条件很奇怪

linux - 提取 message.log 文件中部分时间戳的 Shell 脚本程序

linux - WSL2 中克隆的 git 存储库不断消失。这是为什么?

php - 如何在 PHP 中使用 curl?