OS X:列出并删除带空格的文件 [英] OS X: list and remove files with spaces
本文介绍了OS X:列出并删除带空格的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在OS X中执行此操作:
I'd like to do this in OS X:
ls -rt | xargs rm -i
但是,rm
令人窒息,因为某些文件具有空格.
However, rm
is choking on the fact that some of the files have whitespaces.
我之所以提到OS X,是因为BSD的ls
版本没有-Q
标志.
I mention OS X because BSD's version of ls
does not have a -Q
flag.
是否有一种无需使用find -print0
的方法?
Is there a way to do this without having to use find -print0
?
推荐答案
尝试一下
while read -u 3
do
rm -i "$REPLY"
done 3< <(ls -rt)
这篇关于OS X:列出并删除带空格的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文