Use given listDirectory function