我正在使用此命令尝试删除一个非常大的文件夹中的所有 Thumbs.db 文件。我认为 -f
应该在不要求确认的情况下强制删除,但我仍然被提示在每个文件上输入“y”或“n”。
find "megapacks" -name Thumbs.db -ok rm -f {} \;
我尝试键入 rm
来查看是否有别名,它的响应是
rm is aliased to `rm -i'
我尝试使用 /bin/rm
代替,但仍然提示我
find "megapacks" -name Thumbs.db -ok /bin/rm -f {} \;
有没有人对如何避免确认有其他想法?
最佳答案
问题出在 -ok
选项上,根据 man find
:
Like
-exec
but ask the user first. If the user agrees, run the command. Otherwise just return false.
这应该适用于 -exec
:
find "megapacks" -name Thumbs.db -exec /bin/rm -f {} \;
或更快:
find "megapacks" -name Thumbs.db -exec /bin/rm -f {} +
关于bash - `rm -f` 要求确认,别名为 `rm -i`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38719531/