Is there a better way to check if a dir is empty than parsing it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Don’t think so. Shortest/quickest way I can think of is the following, which should work as far as I can see.
This should only go through a maximum of 3 files. The two
.and..and potentially whatever comes next. If something comes next, it’s not empty, and if not, well then it’s empty.