--- Snippet of my build.xml following IVAN suggestions that process
extensions "*.tab", "*.ind" and "*.seq" ----
<?xml version="1.0" encoding="UTF-8" ?>
<project basedir="." name="baseProject" default="help">
    <property name="master_base" value="c:\StarTeam\MyProject\release"/>
    <macrodef name="partial_file">
        <attribute name="extension"/>
        <sequential>
                        <fileset dir="${master_base}"
id="@{extension}.files.fs">
                                <include name="**/[EMAIL PROTECTED]"/>
                        </fileset>
                        <pathconvert property="@{extension}.files"
pathsep="${line.separator}" refid="@{extension}.files.fs">
                                <globmapper
from="${master_base}${file.separator}*" to="@*"/>
                        </pathconvert>
                        <echo
file="@{extension}.txt">[EMAIL PROTECTED]</echo>
        </sequential>
    </macrodef>
    <target name="masterlist">
                <partial_file extension="tab">
                </partial_file>
                <partial_file extension="ind">
                </partial_file>
                <partial_file extension="seq">
                </partial_file>
                <move file="tab.txt" tofile="master.sql">
                        <filterchain>
                                <concatfilter append="ind.txt"/>
                                <concatfilter append="seq.txt"/>
                        </filterchain>
                </move>
                <delete file="tab.txt"/>
                <delete file="ind.txt"/>
                <delete file="seq.txt"/>
    </target>
</project>

******** "master.sql" using target "masterlist" *****
@temp/[EMAIL PROTECTED]/temp1.ind
@temp4/[EMAIL PROTECTED]/temp2.seq
@temp5/temp5.seq
********

Now the issue is while appending files together in the master list.
I want to know how I can use concatfilter to append the output of the
next text file in a new line in target file? i.e., the final output of
the target file should look like the following:
------- Final "master.sql" ----
@temp/temp.tab
@temp1/temp1.ind
@temp4/temp4.ind
@temp2/temp2.trg
@temp5/temp5.trg
--------

Thanks,
Mohan

-----Original Message-----
From: Ivan "Rambius" Ivanov [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 19, 2006 9:11 PM
To: Ant Users List
Subject: RE: Create a file that contains files in directory

Hello,

--- "Guttula, Mohan" <[EMAIL PROTECTED]> wrote:

> The issue was with relative path in the base
> directory. i.e., 
> <property name="master_base" value="release"/>
> 
> Issue is resolved by using IVAN suggestion which is
> as follows:
> -----
> <property name="master_base" location="release"/>
> -----

Defining location of files and dirs with location
attribute comes vary handy when one deals with
mappers. This attribute allows you to cite the files
with their relative (to ${basedir}) names and yet Ant
deals works with their absolute paths taking care of
slashes and backslashes.

> 
> Ivan - do you know if I can append "@" to the
> beginning of each line in
> the target directory. i.e., 
> **** Target file (master.sql) *****
> @temp/temp.tab
> @temp1/temp1.ind
> @temp2/temp2.trg
> @temp3/temp3.seq
> @temp4/temp4.ind
> @temp5/temp5.trg
> ******************

I believe you can do it:
    <pathconvert property="all.files"
pathsep="${line.separator}"
        refid="all.files.fs">
        <globmapper
from="${basedir}${file.separator}*" to="@*"/>
    </pathconvert>

> I also want to know if we can use some Ant task to
> rearrange line the
> target file (or should I write my custom ANT task).
> For example in the
> following way
> ******** Final "master.sql"*****
> @temp/temp.tab
> @temp1/temp1.ind
> @temp4/temp4.ind
> @temp2/temp2.trg
> @temp5/temp5.trg
> @temp3/temp3.seq
> ********
> 
> In the above file, I have to rearrange lines based
> on the extension.

In the examples above, we use <fileset>s which
collects the files in a random way, which is not
controlled by Ant, but by the underlying OS. If you
deal only with not so many different extensions you
can define <fileset>s for each of them and repeat
pathconvert + mapper trick for each <fileset> (and
that sounds like a  <macrodef>)

Regards
Ivan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



**************************************************************
This message, including any attachments, contains confidential information 
intended for a specific individual and purpose, and is protected by law.  If 
you are not the intended recipient, please contact sender immediately by reply 
e-mail and destroy all copies.  You are hereby notified that any disclosure, 
copying, or distribution of this message, or the taking of any action based on 
it, is strictly prohibited.
TIAA-CREF
**************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to