Empty directory
Built-in method:
Dir('/my/dir').is_empty; # true, false or nil
User-defined function:
func is_empty(dir) {
dir.open(\var dir_h) || return nil;
dir_h.each { |file|
file ~~ ['.', '..'] && next;
return false;
};
return true;
};