File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes moving files via ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "moving files via ant" Watch "moving files via ant" New topic

moving files via ant

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
i have a war hidden at a sublevel with a directory 'Axx'(C:\Axx\output\classes\lib\*.war).
This needs to need to be copied over to the root loaction of dir 'Bxx'.

If I write a ant move task as:
<move todir="${deploy_dir}">
<fileset dir="${output_dir}">
<include name="**/*.war"/>
This would copy over but maintain the directory structure rather than put in under C:\Bxx.
I can do a hard-coding of the full path;but i would rather avoid that.

Is there some way possible to achive this 'move' without resorting to hard-coding of the entire path to the file?

Peter Johnson

Joined: May 14, 2008
Posts: 5852

Try adding the "flatten" attribute to the copy task.

JBoss In Action
subject: moving files via ant
It's not a secret anymore!