How can I check if a file is empty?

后端 未结 4 2083
春和景丽
春和景丽 2021-02-18 18:51

I have thousands of text files and would like to know how to check if a particular file is empty. I am reading all the files using this line of code

Y<-grep(\         


        
4条回答
  •  Happy的楠姐
    2021-02-18 19:23

    Use the following code to check if a file in the system is empty or not before uploading it.

    my_file<-readLines(paste0(""))
    my_file=="" #TRUE - means the file is empty
    

提交回复
热议问题