Adam S
File.listFiles()
└── some-dir/ ├── a.txt ├── b.json ├── c.xml └── sub-contents/ └── x.txt
File("$basePath/some-dir").walk().maxDepth(1)
a.txt
b.json
c.xml
some-dir
sub-contents
Oleg Yukhnevich
Path
Stephan Schröder
fun File.walkFiles(maxDepth: Int): List<File> = this.walk().maxDepth(maxDepth).filter{it.isFile()}.toList()
fun File.walkFiles(maxDepth: Int): Sequence<File> = this.walk().maxDepth(maxDepth).filter{it.isFile()}
A modern programming language that makes developers happier.