simple recursive dirwalking function