ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastien Blanc <Sebastien.Bl...@alcatel.com>
Subject Re: Renaming a directory when the source directory is not known
Date Tue, 15 Apr 2003 14:48:48 GMT
oops, you don't know the name of the file at that time.
then why not building a fileset '*' of what is under your output directory, then converting
it into a property (with pathconvert or so) as if you wanted to print this fileset and here
you have your directory name dynamically.
let me know if this is enough clear,
seb.

Sebastien Blanc wrote:

> ok. so you can do a move as u did, the only remaining pb beeing to dynamically get the
name of the directory for your archive into a property.
> how about the dirname task ?
> seb.
>
> "Halstead, Chris" wrote:
>
> > Seb - Thanks again for all your help.  Your example works just fine, but the problem
is that the source directory won't always be named 'foo'.  I need a way to do what the code
snippet below does without having to know that the directory is named 'foo' beforehand.
> >
> > What I'm trying to accomplish is this: when I extract a ZIP archive to the output
dir I end up with something like /output/archive-1.2.3.  I want to change it to be /output/archive
without having to know that the original was named 'archive-1.2.3'.
> >
> > Thanks,
> >
> > -chris
> >
> > >
> > > Chris,
> > > I just did the following test:
> > > <?xml version="1.0"?>
> > > <project name="test move" default="main">
> > >
> > > <property name="output.dir" value="somedir" />
> > > <property name="target" value="bar" />
> > >
> > > <target name="mv">
> > >
> > >   <move todir="${output.dir}/${target}">
> > >     <fileset dir="${output.dir}/foo">
> > >     </fileset>
> > >   </move>
> > > </target>
> > >
> > >  </project>
> > >
> > > and somedir/foo directory is moved to somedir/bar directory
> > > just fine (having recursive content in foo at the beginning).
> > > am I missing smthg ? if ur example it looks to me you move
> > > somedir directory to somedir/bar directory which would be
> > > somewhat a bit difficult. [also are u sure the ${target}
> > > property is defined properly when your PREP target is called
> > > ? if the pattern is erroneous then the mapper will not do anything.]
> > >
> > > FYI <mapper> cd then be embedded into the fileset to map the
> > > new files to new directory or names but looking at your need
> > > the above is enough.
> > >
> > > hope this will help, maybe add an echo "mv-ing ${your_from}
> > > to ${your_to}" before the call to <move> to see what is happening.
> > >
> > > seb.
> > >
> >
> > ---------------------------------------------------------------------
> > 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