Details
-
New Feature
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.1-beta-2
-
None
-
all
Description
Deleting a directory including all subdirectories is a very tedious task. A method in File like "deleteRecursively()" would really help.
I am currently using already qutie nice code like this:
def dataDir = new File( ... path ...)
def dirs = []
dataDir.eachFileRecurse {
if (!it.isDirectory()) log.info("Deleting ${it.name}: ${it.delete()}")
else dirs << it
}
dirs.reverse().each { log.info("Deleting directory: ${it.name}: ${it.delete()}") }
But why could it not be new File ( ... dir ...).deleteDir() or similar?