Delete non-zip files in a directory recursively


/ Published in: Groovy
Save to your folder(s)

Very basic but I use various variations all the time.


Copy this code and paste it in your HTML
  1. new File(args[0]).eachFileRecurse() { f ->
  2. if (f ==~ /.*zip$/ || !f.isFile()) return
  3. f.delete()
  4. println f.toString() + " removed"
  5. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.