We Recommend

HTML: The Definitive Guide HTML: The Definitive Guide
They teach you that learning HTML is like learning any other language and that reading a book of rules can only take you so far. Readers begin writing what may be their first Web page just two pages into the book's second chapter. From there on, they provide a wide range of HTML coding to allow readers to learn from good examples. The book includes a handy "cheat sheet" of HTML codes for quick reference.


Posted By

hansamann on 01/03/07


Tagged

file directory deleting removing cascading


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

jsbournival


Deleting all files and subdirectories


Published in: Groovy 


This (almost) one-liner cascades into all subdirectories and deletes the files first, then the directories. Makes deleting a directory really easy. This was originally posted by John Wilson into the Groovy user list.


  1. def c
  2. c = {println "Dir ${it.canonicalPath}"; it.eachDir(c); it.eachFile{println "File ${it.canonicalPath}"; it.delete()}}
  3. c new File("test")

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: MarcDexet on January 3, 2007

Sorry I'm struggling with Markdown :)

Posted By: MarcDexet on January 3, 2007

@see Groovy Wiki.

Posted By: MarcDexet on January 3, 2007

@see Groovy Wiki.

You need to login to post a comment.