假设我们在目录中有以下文件:
test.txt
test.txt~
/subdir
test1.txt
test1.txt~
当我rm -r ./*.*~
在top dir内运行时,只会删除test.txt〜。
尽管我使用了递归标志,但为什么它不执行递归删除呢?
您可以使用以下脚本重现我的情况:
#create dir and 1-st level test files
mkdir dir
cd dir
touch test.txt
touch test.txt~
#create subdir and 2-nd level test files
mkdir subdir
cd subdir/
touch test1.txt~
touch test1.txt
cd ..
rm -r ./*.*~
*.*~
不会扩展到任何目录,它只会匹配当前目录中.
位于某处并以结束的任何文件或目录~
如果你想找到的所有文件为此在~
从你在我使用的目录find
一样
find -type f -name '*~' -delete
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句