Suzan Cioc
Suzan Cioc

Reputation: 30147

How to copy several subdirectories with FTP task with Ant?

Suppose I want to upload

./WEB-INF/classes

and

./WEB-INF/lib

to

<myserver>/Folder/WEB-INF/classes

and

<myserver>/Folder/WEB-INF/lib

respectively.

Can I do this with one FTP task?

I can't use

<ftp server="myserver" remoteDir="Folder/WEB-INF/">
    <fileset dir="WEB-INF" />
</ftp>

because this will copy everything in WEB-INF which I don't need.

Upvotes: 3

Views: 976

Answers (1)

joescii
joescii

Reputation: 6543

Sure can. Just use include filters. The double asterisk matches any directory name. The single asterisk matches any file name.

<ftp server="myserver" remoteDir="Folder/WEB-INF/">
  <fileset dir="WEB-INF" >
    <include name="classes/**/*"/>
    <include name="lib/**/*"/>
  </fileset>
</ftp>

Upvotes: 3

Related Questions