Comment detail

指定されたフォルダ以下のゴミ掃除 (Nested Flatten)

	
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import java.io._

object FileUtil {
  def removeFilesBySuffix(d:String, s:String):Unit = {
    removeFilesBySuffix(new File(d), s)
  }
  def removeFilesBySuffix(d:File, s:String):Unit = {
    d.list.foreach(f => {
      val c = new File(d, f)
      if(c.isDirectory) removeFilesBySuffix(c, s)
      else if(f.endsWith(s)) c.delete
    })
  }
}

Index

Feed

Other

Link

Pathtraq

loading...