guard clause that prevents listing empty directories