title: Grails/Groovy file deletion
body: <p>I am having a tough time deleting a file.  I will show you what is working, and you can be the judge if this is acceptable.</p>
  
  <pre><code>class StupidService{
  def doThings(){
    def tmpDirString = "dumpit"
    def currentDir = new File("../${tempDirString}")
    currentDir.eachFile(FileType.FILES){
      def f=it
      def answer = SuperComplicatedService.doStuff(f)
      //this works, now I need to move the file to the "done" folder
      File dir = new File("../${tempDirString}/done");  
      def endupFile = new File("../${tempDirString}/done/${f.name}")
      FileUtils.copyFile(f, endupFile)
      //this works; the file is copied to where I want it successfully; now I just need to delete the initial file.
      def thisIsAJoke=0
      while(f.delete()==false){
        println "This is not a joke: ${thisIsAJoke}"
        thisIsAJoke++
      }
  
    }
  }
  }
  </code></pre>
  
  <p>And so this prints out between 40k and 150k lines of "This is not a joke: 64457" etc. and then finally deletes the file.</p>
  
  <p>What is going on?</p>