0
我正在使用linux bash。现在我想清除所有.txt文件的内容。但是,此命令“find -type f -iname' .txt'| xargs -I {} echo”“> {}”似乎不起作用。有什么建议么?任何有关更好解决方案的想法“find -type f -iname'* .txt'| xargs -I {} echo”“> {}”不起作用
我正在使用linux bash。现在我想清除所有.txt文件的内容。但是,此命令“find -type f -iname' .txt'| xargs -I {} echo”“> {}”似乎不起作用。有什么建议么?任何有关更好解决方案的想法“find -type f -iname'* .txt'| xargs -I {} echo”“> {}”不起作用
我truncate
以清除文件替换echo
和使用发现的,而不是-exec
管道到xargs
:
find . -type f -name "*.txt" -exec truncate -s 0 {} \;