Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
java
java
// Create a ref for closure
def delClos

// Define closure
delClos = { println "Dir ${it.canonicalPath}";
            it.eachDir( delClos );
            it.eachFile {
                println "File ${it.canonicalPath}";
                it.delete()
            }
		it.delete()
}

// Apply closure
delClos( new File("D:/tmp/test") )

An Even Groovier Way

Using the Groovy JDK extensions to File

Code Block
languagegroovy
new File("D:/tmp/test").deleteDir()