my $numfiles = grep { -T "$config{'basepath'}$key/$_" } readdir DIR;