sathya_dev
sathya_dev

Reputation: 513

How to echo the file names that only copied or removed by sync task in ant?

I'm trying to copy the schema files from my workspace to a config folder as part of build.

I've achieved that by using the sync task.

These are my requirements:

1.Need to replace only the latest not every file each time.
2.Need to display in console, what are the files being changed (copied /removed)

<target name="copy-schema">
    <sync todir="C:/config/schema">
        <fileset dir="${schema.dir}" id="schema_dir"/>
        <preserveintarget preserveemptydirs="true">
            <include name="**/**" />
        </preserveintarget>
    </sync>
</target>

This copies the schema Files, but I'm not able to see what are the files copied.

I've tried the below,

<target name="copy-schema">
    <sync todir="C:/config/schema">
        <fileset dir="${schema.dir}" id="schema_dir"/>
        <preserveintarget preserveemptydirs="true">
            <include name="**/**" />
        </preserveintarget>
    </sync>
    <property name="filesCopied" refid="schema_dir"/>
    <echo>${fileCopied}</echo>
</target>

But it prints all the files in the directory.

Any help is appreciated.

Thanks in advance

Upvotes: 0

Views: 734

Answers (1)

ewan.chalmers
ewan.chalmers

Reputation: 16235

The sync task supports a verbose attribute to log the files that are being copied.

Try adding the verbose attribute in your sync:

<sync todir="C:/config/schema" verbose="true">

Upvotes: 2

Related Questions