war*_*ren 35
直接回答你的问题,“不 - 你不能做你描述的事情rm
”。
但是,您可以将其与find
. 以下是您可以执行此操作的众多方法之一:
# search for everything in this tree, search for the file pattern, pipe to rm
find . | grep <pattern> | xargs rm
Run Code Online (Sandbox Code Playgroud)
例如,如果您想取消所有 *~ 文件,您可以这样做:
# the $ anchors the grep search to the last character on the line
find . -type f | grep '~'$ | xargs rm
Run Code Online (Sandbox Code Playgroud)
从评论扩展*:
# this will handle spaces of funky characters in file names
find -type f -name '*~' -print0 | xargs -0 rm
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
19503 次 |
最近记录: |