ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilbreath, Jason" <jgilbre...@solant.com>
Subject RE: fileset question
Date Wed, 22 Nov 2000 15:33:11 GMT
Yes! This does what I would like but I am trying to make this as automated
as possible, in other words, I need /new/filelist.txt to be generated in the
proper
format on the fly from within ant.

	This would entail something like this

	<!-- generate the first list of /new -->

	<exec executable="ls" dir="new" output="beginfile.txt" >
		<arg value="-1" />
	</exec>

	<!-- generate the formatted list -->

	<exec executable="sh" dir="new" output="thefile.txt">
		<arg value="-c &quot;cat new/beginfile.txt | sed -e
's/$/\/**/g'&quot;" />
	</exec>

		Then continue.......

This errors out explaining that I can't have double and single quotes in the
same argument.

	I have tried placing &quot; around the sed but that errors out as
well.

If anyone knows of a way, please let me know, otherwise, I will have to
either pre-format the file or use some external script to do so.

Thanks Diane and Stefan for your help.

-jason



-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@apache.org]
Sent: Wednesday, November 22, 2000 02:51
To: ant-user@jakarta.apache.org
Subject: Re: fileset question


Diane Holt <holtdl@yahoo.com> wrote:

> But maybe Stefan will have some trick up his sleeve that can do that
> for you.

Me or another Stefan? OK, I'll give it a try.

In Jason's very first mail he used includesfile on the new directory,
so we can assume there is somebody that can put together a list of
directories that need to get copied/moved.

So let's say, there are directories new/a, new/b and new/c that should
replace the ones in orig. Create a file new/filelist.txt with the
following content

-------------------------snip---------------------------
a/**
b/**
c/**
------------------------/snip---------------------------

This is what Jason wanted to do anyway, just added the ** to make sure
the patterns match more than just the directories themselves.

Next define your patternset, either outside any target (if possible,
this happens at parser time) like this

<patternset id="the.dirs" includesfile="new/filelist.txt" />

or in process when using the first move task. I'd use the latter approach

<move todir="backup" >
  <fileset dir="orig" >
    <patternset id="the.dirs" includesfile="new/filelist.txt" />
    <!-- use this when the.dirs has been defined before
      <patternset refid="the.dirs"/>
    -->
  </fileset>
</move>

and finally

<move todir="orig" >
  <fileset dir="new" >
    <patternset refid="the.dirs"/>
  </fileset>
</move>

Does this do what you want Jason?

Stefan

Mime
View raw message