我有成千上万个文本文件,想知道如何检查特定文件是否为空。我正在使用此行代码读取所有文件
Y<-grep("*.txt", list.files(), value = TRUE)
我想要所有空白文件的名称列表。必须在R中执行。
谢谢。
find . -empty
如果只想限制txt文件:
find . -empty |awk -F\/ '{print $FN}'
如果仅需要asci文件(而不只是.txt)
find . -empty -name "*.txt"
全部放在一起:
find . -empty -type f
find . -empty -type f -name "*.txt" |awk -F\/ '{print $NF}'