> -----Original Message-----
> From: Ramarao_4s [mailto:[email protected]]
> Sent: 26 April 2011 14:08
> To: [email protected]
> Subject: Need to copy a set of files from a directory tree dynamically
>
> Hi All,
>
> I have a requirement where I need to copy a set of files from
> a directory
> tree, can any one help me in resolving this.
>
> My directory structure is
> Ant Tesing
> + build(Folder)
> + Main(Folder)
> + Result(Folder)
>
> Under my Main Folder I have different sub Folders with
> different names which
> in turn contains images folder . so my Main Folder will look like
> Main
> + App1 (Folder)
> + images(Folder)
> + US-pics(Folder) (contains nevada.jpeg file)
> + EU-pics(Folder) (contains norway.jpeg file)
> + App2 (Folder)
> + images (Folder)
> + Asia-pics(Folder)(contains osaka.jpeg file)
> + App3 (Folder)
> + images(Folder)
> + US-pics(Folder) (contains atlanta.jpeg file)
>
> Now my requirement is i need to copy all these jpeg images
> from respective
> images folder to Images directory under Results folder.so my output
> directory should look like this.
>
> Results (Folder)
> + Images(Folder)
> + US-pics(Folder) (contain both nevada.jpeg,atlanta.jpeg file)
> + EU-pics(Folder) (contains norway.jpeg file)
> + Asia-pics(Folder)(contains osaka.jpeg file)
>
> I need to achieve this using ant script i am trying to do
> this using below
> script but couldn't succeed.
>
> <copy todir="${build.home}/images">
> <fileset dir="${dynamic.home}" >
> <include name="**/**/images/**/*"/>
> </fileset>
> </copy>
>
> Please help me in resolving this.
Take a look at the mapper capabilities.
Untested, but should give you an idea of the direction to go:
<copy todir="${build.home}/images">
<fileset dir="${dynamic.home}" >
<include name="**/images/**/*.jpeg" />
</fileset>
<cutdirsmapper dirs="2" />
</copy>
If you don't have ant 1.8.2, you might have to try filtermapper or regexpmapper
to manipulate:
i.e. '<regexpmapper to="\1" from=".*/images/(.*)$" />' should also do similar
to the cutdirsmapper.
--
Regards,
Darragh Bailey
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]