Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将如何去获取,作为输出
rm -r
一个文件夹上的命令,它操作的文件数?
谢谢!
您可以这样做(rm至少使用 GNU):
rm
rm -rv dir | wc -l
该-v标志导致rm输出如下行:
-v
removed `dir/file' removed directory: `dir'
并wc -l计算行数。如所写,计数将包括删除的目录。你可以用类似的东西去掉那些行,grep -v "^removed directory"但这取决于你的语言环境,所以它可能并不完全可靠。
wc -l
grep -v "^removed directory"