Simple life, Complicated mind
Wednesday, January 5, 2011
Find and Remove Files
Find and Remove Files
$ find . -name "*.pyc" -type f -print0 | xargs -0 /bin/rm -f
一般情況 find 預設使用 -print 參數,如果擔心找到的檔名含有空白、換行等符號,使用 -print0 較安全,而且搭配 xargs 時會使用 -0 參數。
Reference:
what is the difference between find -exec cmd {} + and xargs
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment