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 Mon, 14 Apr 2003 23:34:48 GMT
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.

"Halstead, Chris" wrote:

> Thanks for trying, but I'm having no luck.  I'll start fresh in the morning....
>
> -chris
>
> ----Original Message-----
> From: Sebastien Blanc
> Sent: Monday, April 14, 2003 6:27 PM
> To: Ant Users List
> Subject: Re: Renaming a directory when the source directory is not known
>
> the first move try will move the output.dir under the output.dir/target dir value.
> u need to use include for instance to move a set of file in ur fileset:
> first try to <include name="*"/> or **/* in your move task.
>
>   <move todir="${output.dir}/${target}">
>     <fileset dir="${output.dir}">
>       <include name="**/*"/>
>     </fileset>
>   </move>
>
> seb.
>
> "Halstead, Chris" wrote:
>
> > I tried this first:
> >
> >   <target name="PREP">
> >         <move todir="${output.dir}/${target}">
> >                 <fileset dir="${output.dir}"/>
> >         </move>
> >   </target>
> >
> > This gave me /some/dir/bar/foo instead of /some/dir/bar.
> >
> > I then tried the mapper listed below (<mapper type="glob" from="${output.dir}/*"
to="${output.dir}/${target}"/>) instead of the <move> task.  This did nothing.
> >
> > I'm just at a loss....
> >
> > -chris
> >
> > -----Original Message-----
> > From: Sebastien Blanc
> > Sent: Monday, April 14, 2003 6:08 PM
> > To: Ant Users List
> > Subject: Re: Renaming a directory when the source directory is not known
> >
> > no, paths are alrite too. how are u using your mapper then ?
> > seb.
> >
> > "Halstead, Chris" wrote:
> >
> > > I tried  <mapper type="glob" from="${output.dir}/*" to="${output.dir}/${target}"/>,
where ${target} is the name I want it to have.  This did nothing...does mapper only work with
files?
> > >
> > > -chris
> > >
> > > -----Original Message-----
> > > From: Sebastien Blanc
> > > Sent: Monday, April 14, 2003 5:52 PM
> > > To: Ant Users List
> > > Subject: Re: Renaming a directory when the source directory is not known
> > >
> > > did u try using a <mapper> (type="glob" or so) instead of move ?
> > > seb.
> > >
> > > "Halstead, Chris" wrote:
> > >
> > > > OK, this has been driving me nuts.  I'm trying to figure out how to rename
a directory when the original directory name is not known beforehand (or is variable), such
as when unpacking an archive with an arbitrary base directory.
> > > >
> > > > e.g.:
> > > >
> > > > I unpack a ZIP archive to /some/dir and end up with /some/dir/foo/...
> > > >
> > > > I want to rename /some/dir/foo to /some/dir/bar, but I don't want to hard
code a reference to /some/dir/foo 'cuz it may change.
> > > >
> > > > Anyone have a clue?  I'm stumped.
> > > >
> > > > Thanks in advance.
> > > >
> > > > -chris
> > > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message