Fast test if directory is empty

前端 未结 1 657
灰色年华
灰色年华 2021-01-04 22:13

What is the fastest way to test if a directory is empty?

Of course I can check the length of

list.files(path, all.files = TRUE, include.dirs = TRUE,          


        
相关标签:
1条回答
  • 2021-01-04 22:56

    How about if(length(dir(all.files=TRUE)) ==0) ?

    I'm not sure what you qualify as "fast," but if dir takes a long time, someone is abusing your filesystem :-(.

    0 讨论(0)
提交回复
热议问题