https://kotlinlang.org logo
#announcements
Title
# announcements
c

chb0kotlin

06/06/2017, 6:09 PM
I am not entirely sure how to use
File.walk
someone got a handy example
d

diesieben07

06/06/2017, 6:13 PM
chb0kotlin: Like any other sequence, you can just iterate over it with
for (file in folder.walk())
r

rocketraman

06/06/2017, 6:18 PM
Or more functionally something like this:
Copy code
val files = File(...).walkTopDown()
    .filter { it.isFile }
    .filter { match.matches(it.name) }
    .map(File::toPath)
👍 1
c

chb0kotlin

06/06/2017, 6:19 PM
Ah, ok. I was looking for a functional application. .... Yeah, just like that 🙂
r

rocketraman

06/06/2017, 6:21 PM
There is
walk
,
walkTopDown
and
walkBottomUp
also, in case order matters.
All extension functions in stdlib