Skip to content

Instantly share code, notes, and snippets.

@notyy
Created March 4, 2014 09:07
Show Gist options
  • Save notyy/9342843 to your computer and use it in GitHub Desktop.
Save notyy/9342843 to your computer and use it in GitHub Desktop.
import java.io._
def delDirNoRecur(dirName: String): Unit = {
val dir = new File(dirName)
if(dir.exists && dir.isDirectory){
val files = dir.listFiles
files.foreach(_.delete())
println(s"delete complete ${files.size} files deleted")
}else{
println(s"$dirName not a directory")
}
}
delDirNoRecur("test")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment