1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Pathオブジェクトでのファイルの探索

Posted at

import java.nio.file._

// ファイルを探索する
def walkFiles(path:Path) {
	val visitor = new SimpleFileVisitor[Path] {
		override 
		def preVisitDirectory(
			dir:Path
		,	attr:BasicFileAttributes
		): 	FileVisitResult = {
			println(dir)
			FileVisitResult.CONTINUE
		}
		override 
		def visitFile(
			file:Path
		,	attr:BasicFileAttributes
		):	FileVisitResult = {
			println(file)
			FileVisitResult.CONTINUE
		}
	}
	Files.walkFileTree(path, visitor);
}
// Zip内のファイルを列挙
walkFiles(zipFs.getPath("/"))

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?