aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Sub Folder files copy Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Sub Folder files copy Problem" Watch "Sub Folder files copy Problem" New topic
Author

Sub Folder files copy Problem

sasank ch
Greenhorn

Joined: Nov 07, 2007
Posts: 25
Hi All,
I have one requirement.Could you please give me any solution.
My folder structures as follows:
Root\
Root\sub1\sample1.txt
Root\sub2\sample2.txt


I need to copy all text files into Target folder.
Please find the my Ant target as follows:
<target name="copyFiles">
<copy todir="C:/Target">
<fileset dir="C:/Root">
<includesfile name="**/*.txt"/>
</fileset>
</copy>
</target>


But it will copies the text files as well as folder sttructue on Target folder.
I am expecting Target folder as follows:
Target\
Sample1.txt
Sample2.txt


Could any body please give me solution for this.

Regards,
Sasank.

Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2712
    
    5

"sasank ch " please check your private messages for an important administrative matter. You can check them by clicking the My Private Messages link above.


SCJP, SCWCD.
|Asking Good Questions|
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

try:

<includesfile name="*.txt"/>


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sub Folder files copy Problem
 
Similar Threads
script for help
unable to create War using Ant
Exclude of folder from being copied!?
How to create directory and subdirectory with files.
What does ${user.home} means ? Where is build .properties ?