Created
          November 26, 2014 15:25 
        
      - 
      
- 
        Save davetownsend/85b25e2d2cf342eb46af to your computer and use it in GitHub Desktop. 
Revisions
- 
        davetownsend created this gist Nov 26, 2014 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ // needed to rename over 900 files in a dir from a pattern like // noa_6989589000_201404080445010001.pdf to NAR6989589000.pdf where the 6989589000 part // (different on every file) is the needed in the new file. // simply run from the CLI: groovy rename.groovy dir = "/path to files" def pre = "NAR", ext = ".pdf" new File(dir).eachFile() { f -> def name = f.name.split('_')[1] f.renameTo("${pre}${name}${ext}") }