title: Groovy / jenkins : rename file
body: <p>I would like to rename lastModified() json as filename+"processing" in jenkins with groovy. I am unsuccessfully doing : </p>
  
  <pre><code>JSON_BASE_PATH="/json_repo/"
  
  def file = new File(JSON_BASE_PATH).listFiles()?.sort { it.lastModified() }?.find{it=~/.json$/}
  file.renameTo( new File( file.getName() + ".processing") )
  print "Filename is : " + file
  </code></pre>
  
  <p>How to rename it ?</p>