How to copy files in Groovy

后端 未结 8 1679
余生分开走
余生分开走 2020-12-13 17:37

I need to copy a file in Groovy and saw some ways to achieve it on the web:

1

new AntBuilder().copy( file:\"$sourceFile.canonicalPath\", 
                  


        
8条回答
  •  再見小時候
    2020-12-13 17:46

    If it is a text file, I would go with:

      def src = new File('src.txt')
      def dst = new File('dst.txt')
      dst << src.text
    

提交回复
热议问题