ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject Re: regexpmapper question
Date Fri, 20 Oct 2006 13:39:40 GMT
>           <!-- copies everything including foo-x.x.x-bar -->
>           <!--<regexpmapper from="foo-(\d).(\d).(\d)-bar/.*" to="\0"
> handledirsep="yes" />-->
May be a difference between windows and unix (handling of / and \ characters
for file sep)
Try:

 <!-- copies everything including foo-x.x.x-bar -->
 <!--<regexpmapper from="foo-(\d).(\d).(\d)-bar/.+" to="\0"/>

Peter

On 10/20/06, Fenlason, Josh <jfenlason@ptc.com> wrote:
> This is what I've tried so far but still without success.  If anyone
> else has any suggestions, I would be extremely grateful.  Thanks in
> advance.
> ,
> Josh.
>  <copy todir="${dest.dir}">
>           <fileset dir="${temp.dir}" />
>           <!-- copies everything including foo-x.x.x-bar -->
>           <!--<regexpmapper from="foo-(\d).(\d).(\d)-bar/.*" to="\0"
> handledirsep="yes" />-->
>
>           <!-- says it copies 1067 files but all I see is a file named
> "0" -->
>           <!--<regexpmapper from="foo-(\d).(\d).(\d)-bar/.*" to="\1"
> handledirsep="yes" />-->
>
>           <!-- says it copies 1067 files but all I see is a file name
> "3" -->
>           <!--<regexpmapper from="foo-(\d).(\d).(\d)-bar/.*" to="\2"
> handledirsep="yes" />-->
>
>           <!-- doesn't copy anything -->
>           <!--<mapper type="regexp"
> from="${temp.dir}/foo-(\d).(\d).(\d)-bar/(.*)$$" to="\1" />-->
>
>           <!-- doesn't copy anything -->
>           <!--<mapper type="regexp"
> from="${temp.dir}/foo-(.*)-bar/(.*)$$" to="\2" />-->
>
>           <!-- doesn't copy anything -->
>           <!--<regexpmapper
> from="${temp.dir}/foo-(\d).(\d).(\d)-bar/(.*)$$" to="\1" />-->
>
>           <!-- doesn't copy anything -->
>           <!--<regexpmapper
> from="${temp.dir}/foo-(\d).(\d).(\d)-bar/(.*)$$" to="\1"
> handledirsep="yes" />-->
>
>           <!-- doesn't copy anything -->
>           <!--<regexpmapper from="${temp.dir}/foo-(.*)-bar/(.*)$$"
> to="\2" />-->
>
>           <!-- doesn't copy anything -->
>           <!--<regexpmapper from="${temp.dir}/foo-(.*)-bar/(.*)$$"
> to="\2" handledirsep="yes" />-->
>
>           <!-- doesn't copy anything -->
>           <!--<mapper type="regexp" from="foo-(\d).(\d).(\d)-bar/(.*)$$"
> to="\1" />-->
>
>           <!-- doesn't copy anything -->
>           <!--<mapper type="regexp" from="foo-(.*)-bar/(.*)$$" to="\2"
> />-->
>       </copy>
>
> > -----Original Message-----
> > From: Peter Reilly [mailto:peter.kitt.reilly@gmail.com]
> > Sent: Thursday, October 19, 2006 3:58 PM
> > To: Ant Users List
> > Subject: Re: regexpmapper question
> >
> > On 10/19/06, Fenlason, Josh <jfenlason@ptc.com> wrote:
> > > I'm trying to move some files using regexpmapper and I'm not having
> > > much luck, probably because I'm no good at regular expressions.
> > > I have a directory structure like this:
> > >     foo-0.1.2-bar/js
> > >     foo-0.1.2-bar/css
> > >     foo-0.1.2-bar/util/test
> > >     etc.
> > > I would like to move everything inside of foo-0.1.2-bar, but not
> > > foo-0.1.2-bar itself, to another directory.  One thing is that the
> > > version number in the top directory, foo-0.1.2-bar, will
> > change in the
> > > future, so I need the regular expression to account for that.
> > > Here's what I've tried so far.
> > > <move todir="${dest.dir}">
> > >     <fileset dir="${temp.dir}">
> > >         <include name="*" />
> > >     </fileset>
> > >     <regexpmapper from="${temp.dir}/foo-(\d).(\d).(\d)-bar/*"
> > > to="${destDir}" />
> > > </move>
> > > Unfortunately, this doesn't move anything or give me any errors.  I
> > > don't suppose anyone could give me some pointers?  Thanks
> > in advance.
> > The solution is:
> >
> >     <move todir="dest">
> >       <fileset dir="${basedir}"/>
> >       <regexpmapper
> >         from="foo-(\d).(\d).(\d)-bar/.*"
> >         to="\0"
> >         handledirsep="yes"
> >         />
> >     </move>
> >
> > I am not too sure if you want to do this (use a regex), it
> > may make more sense to use a property containing the name
> > :
> >     <property name="dirname" value="foo-0.1.2-bar"/>
> >     <move todir="dest">
> >       <fileset dir="${basedir}" includes="${dirname}/**/*"/>
> >     </move>
> >
> > or:
> >     <move todir="dest">
> >       <fileset dir="${basedir}" includes="foo-*/**/*"/>
> >     </move>
> >
> > Peter
> >
> > > ,
> > > Josh.
> > >
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
> > additional commands, e-mail: user-help@ant.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message