开发者

Ant FTP task - prevent transferring some files/directories

I want to upload a local folder to my website's FTP with an Ant task like this one:

<ftp password="mypwd" server="myown.server.com" 
    userid="user" 
    passive="true"
    remotedir="myfolder/templates">
    <fileset dir="myfolder/templates">
        <include name="**/*.html"/>
    </fileset>
</ftp>

Unfortunately there are some files I do not want (like CVS, or some commentary files)

I checked on the Ant FTP task documentati开发者_C百科on but I am quite new to these concept.

How to prevent some files to be sent to the FTP?


Have a look at the fileset docs.

Your example should already exclude any file which doesn't end in .html, as once you add an include to a patternset only matched files are included.

To exclude files in CVS directories, try <exclude name="**/CVS/**/*"/>


This is very easy:

First, the Apache Ant documentation relates to the type "Fileset".

With this, you can also exclude any kind of files like the following example:

<ftp password="mypwd" server="myown.server.com" 
    userid="user" 
    passive="true"
    remotedir="myfolder/templates">
    <fileset dir="myfolder/templates">
        <include name="**/*.html"/>
        <exclude name="**/CVS"/>
        <exclude name="**/readme.*"/>
    </fileset>
</ftp>

This will exclude all the CVS directories (any folder/subfolder they can be present) and every files called "readme.*".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜