---
title: "groovy"
author: "dellsoft"
date: "2010-08-09T14:40:58Z"
tags: []
categories: ["编程语言"]
slug: "groovy"
draft: false
lastmod: "2010-08-09T14:40:58Z"
id: 732955
url: "https://dellsoft.iteye.com/blog/732955"
---

def urls =  \["ip1","ip2"]

userid = "user" 

password = "password" 

 

sfile = "c:/a.txt"

ant = new AntBuilder() 

 

urls.each { url -&gt;

    ant.scp(file: "${sfile}", 

 todir: "${userid}@${url}:/appbak/", 

        password: "${password}", 

  trust:"true") 

}