Skip to content

Instantly share code, notes, and snippets.

@ntakk
Created July 25, 2012 08:27
Show Gist options
  • Select an option

  • Save ntakk/3175084 to your computer and use it in GitHub Desktop.

Select an option

Save ntakk/3175084 to your computer and use it in GitHub Desktop.
ディレクトリ内にあるファイルを読み込んで出力するサンプル
import scalax.file.Path
import scalax.file.PathSet
object FilesRead {
def main(args: Array[String]): Unit = {
val fr = new FilesRead
fr.readdir
}
}
class FilesRead {
def readdir:Unit = {
val children: PathSet[Path] = Path("data").children()
children.filter(_.isFile).foreach {child =>
child.lines().foreach { line =>
println(line)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment