in reply to Re: How do I determine whether a folder is empty?
in thread How do I determine whether a folder is empty?

sorry, couldn't resist =]

#!/usr/bin/perl use strict; use warnings; sub isEmpty { opendir(DIR,shift) or die $!; my @files = grep { !m/\A\.{1,2}\Z/} readdir(DIR); closedir(DIR); @files ? 0 : 1; } print isEmpty('./dir') ? "empty\n" : "not empty\n";

cp
----
"Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic."