ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Halstead, Chris" <>
Subject RE: Renaming a directory when the source directory is not known
Date Tue, 15 Apr 2003 12:17:35 GMT
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'.



> 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.

View raw message