How to easily copy a file with Groovy. Two solutions: include a library like the Apache Commons (Net) or simply use ant (AntBuilder from Groovy code). Posted by Brian Pontarelli and Russel Winder
- //importjava.net commons
- FileTools.copyFile("foo.txt", "bar.txt");
- //antbuilder (no import needed!)
- ( new AntBuilder ( ) ).copy ( file : 'blah' , tofile : 'fobar' )
CommentsSubscribe to comments
You need to login to post a comment.