import java.io.File // 1 depth walk newFile(dir_path).listFiles() //返回一个数组,包含该目录下所有文件/目录的File对象,只做1级深度 newFile(dir_path).list() // return the files/directories name below `dir_path`
/** or **/ import scala.reflect.io.Path val ap = Path(dir_path) ap.walk.toList // walk recursively, all depth to the leaf files. ap.walkFilter(cond: Path=>Boolean)