You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by blazingwolf7 <bl...@gmail.com> on 2008/12/22 09:26:47 UTC

Copying Folder

Hi,

I am trying to used ant to copy all files from one folder to another. But
from the directory the files to be copy from contains some folders as well.

<copy todir="${build.dir}">
    		<fileset dir="${basedir}">
      		<include name="*"/>
    		</fileset>
</copy>

I tried to copy all the files except for the folders but fail to do so. Can
anyone advice?
-- 
View this message in context: http://www.nabble.com/Copying-Folder-tp21124245p21124245.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: Copying Folder

Posted by Ja...@rzf.fin-nrw.de.
>/*
>Hmm...there are .txt and other files inside there..
>There are folders as well. I want to ignore all folders and 
>copy the rest of
>the files
>But just keep failing to do that. It copy everything
>*/
>
>i think you want to recursive copy, but only the files without 
>preserving
>the directory structure !?
>
>look at the flatten attribute from copy task or use a flattenmapper


If these answeres doesnt help (enough) please provide an example what
you want to achieve.
What is the original directory structure/files and what do you expect?


Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: AW: Copying Folder

Posted by "Brown, Carlton" <Ca...@compucredit.com>.
It seems to me that you need to use the type selector.

<copy todir="${build.dir}">
 	<fileset dir="${basedir}">
		<include name="*"/>
		<type type="file"/>
	</fileset>
</copy>

http://ant.apache.org/manual/CoreTypes/selectors.html 

This will build a fileset that contains files in ${basedir} but no folders under basedir. 

-----Original Message-----
From: blazingwolf7 [mailto:blazingwolf7@gmail.com] 
Sent: Monday, December 22, 2008 4:12 AM
To: user@ant.apache.org
Subject: Re: AW: Copying Folder


Not really...I just want to copy the files from the root directory But the root directory will have folders as well. Now the problem I faced is how to filter out all the folders so that it only copy the files from the root directory


Rebhan, Gilbert wrote:
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: blazingwolf7 [mailto:blazingwolf7@gmail.com]
> Gesendet: Montag, 22. Dezember 2008 09:53
> An: user@ant.apache.org
> Betreff: Re: Copying Folder
> 
> /*
> Hmm...there are .txt and other files inside there..
> There are folders as well. I want to ignore all folders and copy the 
> rest of the files But just keep failing to do that. It copy everything 
> */
> 
> i think you want to recursive copy, but only the files without 
> preserving the directory structure !?
> 
> look at the flatten attribute from copy task or use a flattenmapper
> 
> Regards, Gilbert
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional 
> commands, e-mail: user-help@ant.apache.org
> 
> 
> 

--
View this message in context: http://www.nabble.com/Copying-Folder-tp21124245p21124700.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


-----------------------------------------
====================================================
This message contains PRIVILEGED and CONFIDENTIAL
information that is intended only for use by the 
named recipient. If you are not the named recipient,
any disclosure, dissemination, or action based on 
the contents of this message is prohibited. In such
case please notify us and destroy and delete all 
copies of this transmission.  Thank you.
====================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: AW: AW: AW: Copying Folder

Posted by blazingwolf7 <bl...@gmail.com>.
Emm....can you give me an example on how to combine the <filelist> and <copy>
together. I fail to do that...

Thanks


Jan.Materne wrote:
> 
> A fileset collects only existing files. It fails only if the "dir"
> directory doesnt exist.
> If the files "must" exist, you could
> - use a <filelist>
> - check the existence with <fail> and a condition, like
>   <fail message="Required files missing">
>     <length length="3">
>       <fileset ...>
> 
> 
> Jan
> 
>>-----Ursprüngliche Nachricht-----
>>Von: blazingwolf7 [mailto:blazingwolf7@gmail.com] 
>>Gesendet: Dienstag, 23. Dezember 2008 10:28
>>An: user@ant.apache.org
>>Betreff: Re: AW: AW: Copying Folder
>>
>>
>>I gave up and decide just to used the copy to copy the files
>>   	 <copy todir="${build.dir}">
>>    		<fileset dir="${basedir}">
>>					<include name="host.txt"/>
>>					<include name="urls_re"/>
>>					<include name="urls"/>
>>    		</fileset>
>>           </copy> 
>>
>>But here I faced another problem again...if one of the file is 
>>missing..it
>>won't come out error. Is there anywhere I can do to stop the 
>>process if a
>>file fail to be copy?
>>
>>
>>
>>Jan.Materne wrote:
>>> 
>>> You could <fileset dir="" includesfile=""/> or <filelist>.
>>> 
>>> Jan
>>> 
>>>>-----Ursprüngliche Nachricht-----
>>>>Von: blazingwolf7 [mailto:blazingwolf7@gmail.com] 
>>>>Gesendet: Dienstag, 23. Dezember 2008 02:37
>>>>An: user@ant.apache.org
>>>>Betreff: RE: AW: Copying Folder
>>>>
>>>>
>>>>Yes..thank you this is a good solution. But now I have a 
>>>>different thought.
>>>>Can I for example prepare a list, then in the list I will 
>>>>specify what file
>>>>I want to transfer from the root directory to the new folder.
>>>>
>>>>Then it will refer to the file to determine which file to copy 
>>>>and which
>>>>file not to transfer.
>>>>Can that be done?
>>>>
>>>>Rebhan, Gilbert wrote:
>>>>> 
>>>>> 
>>>>> 
>>>>> -----Original Message-----
>>>>> From: blazingwolf7 [mailto:blazingwolf7@gmail.com]
>>>>> Sent: Monday, December 22, 2008 10:12 AM
>>>>> To: user@ant.apache.org
>>>>> Subject: Re: AW: Copying Folder
>>>>> 
>>>>> /*
>>>>> Not really...I just want to copy the files from the root directory
>>>>> But the root directory will have folders as well. Now the 
>>>>problem I faced
>>>>> is
>>>>> how to filter out all the folders so that it only copy the 
>>>>files from the
>>>>> root directory
>>>>> */
>>>>> 
>>>>> after reading again, i believe you mean =
>>>>> 
>>>>> a given folderstructure like that =
>>>>> 
>>>>> c:\test>tree /F /A
>>>>> 
>>>>> C:.
>>>>> |   foo.txt
>>>>> |   foobar.txt
>>>>> |   foobaz.txt
>>>>> |
>>>>> +---sub
>>>>> |   \---subsub
>>>>> |           sub.txt
>>>>> |
>>>>> \---sub1
>>>>>     \---subsub
>>>>>             sub1.txt
>>>>> ...
>>>>> 
>>>>> and you want to copy only the files on rootlevel
>>>>> foo.txt
>>>>> foobar.txt
>>>>> foobaz.txt
>>>>> 
>>>>> right ??
>>>>> 
>>>>> to achieve that, just use the *.* include pattern
>>>>> to catch only the files on roolevel =
>>>>> 
>>>>> <project default="copy">
>>>>>  <target name="copy">
>>>>>   <copy todir="C:/flatten">
>>>>>    <fileset dir="C:/test" includes="*.*" />
>>>>>   </copy>
>>>>> </target>
>>>>> </project>
>>>>> 
>>>>> 
>>>>> Regards, Gilbert
>>>>> 
>>>>> 
>>---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>>>> For additional commands, e-mail: user-help@ant.apache.org
>>>>> 
>>>>> 
>>>>> 
>>>>
>>>>-- 
>>>>View this message in context: 
>>>>http://www.nabble.com/Copying-Folder-tp21124245p21138187.html
>>>>Sent from the Ant - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>>>For additional commands, e-mail: user-help@ant.apache.org
>>>>
>>>>
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>> 
>>> 
>>> 
>>
>>-- 
>>View this message in context: 
>>http://www.nabble.com/Copying-Folder-tp21124245p21141650.html
>>Sent from the Ant - Users mailing list archive at Nabble.com.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>For additional commands, e-mail: user-help@ant.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Copying-Folder-tp21124245p21156595.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: AW: AW: Copying Folder

Posted by Ja...@rzf.fin-nrw.de.
A fileset collects only existing files. It fails only if the "dir" directory doesnt exist.
If the files "must" exist, you could
- use a <filelist>
- check the existence with <fail> and a condition, like
  <fail message="Required files missing">
    <length length="3">
      <fileset ...>


Jan

>-----Ursprüngliche Nachricht-----
>Von: blazingwolf7 [mailto:blazingwolf7@gmail.com] 
>Gesendet: Dienstag, 23. Dezember 2008 10:28
>An: user@ant.apache.org
>Betreff: Re: AW: AW: Copying Folder
>
>
>I gave up and decide just to used the copy to copy the files
>   	 <copy todir="${build.dir}">
>    		<fileset dir="${basedir}">
>					<include name="host.txt"/>
>					<include name="urls_re"/>
>					<include name="urls"/>
>    		</fileset>
>           </copy> 
>
>But here I faced another problem again...if one of the file is 
>missing..it
>won't come out error. Is there anywhere I can do to stop the 
>process if a
>file fail to be copy?
>
>
>
>Jan.Materne wrote:
>> 
>> You could <fileset dir="" includesfile=""/> or <filelist>.
>> 
>> Jan
>> 
>>>-----Ursprüngliche Nachricht-----
>>>Von: blazingwolf7 [mailto:blazingwolf7@gmail.com] 
>>>Gesendet: Dienstag, 23. Dezember 2008 02:37
>>>An: user@ant.apache.org
>>>Betreff: RE: AW: Copying Folder
>>>
>>>
>>>Yes..thank you this is a good solution. But now I have a 
>>>different thought.
>>>Can I for example prepare a list, then in the list I will 
>>>specify what file
>>>I want to transfer from the root directory to the new folder.
>>>
>>>Then it will refer to the file to determine which file to copy 
>>>and which
>>>file not to transfer.
>>>Can that be done?
>>>
>>>Rebhan, Gilbert wrote:
>>>> 
>>>> 
>>>> 
>>>> -----Original Message-----
>>>> From: blazingwolf7 [mailto:blazingwolf7@gmail.com]
>>>> Sent: Monday, December 22, 2008 10:12 AM
>>>> To: user@ant.apache.org
>>>> Subject: Re: AW: Copying Folder
>>>> 
>>>> /*
>>>> Not really...I just want to copy the files from the root directory
>>>> But the root directory will have folders as well. Now the 
>>>problem I faced
>>>> is
>>>> how to filter out all the folders so that it only copy the 
>>>files from the
>>>> root directory
>>>> */
>>>> 
>>>> after reading again, i believe you mean =
>>>> 
>>>> a given folderstructure like that =
>>>> 
>>>> c:\test>tree /F /A
>>>> 
>>>> C:.
>>>> |   foo.txt
>>>> |   foobar.txt
>>>> |   foobaz.txt
>>>> |
>>>> +---sub
>>>> |   \---subsub
>>>> |           sub.txt
>>>> |
>>>> \---sub1
>>>>     \---subsub
>>>>             sub1.txt
>>>> ...
>>>> 
>>>> and you want to copy only the files on rootlevel
>>>> foo.txt
>>>> foobar.txt
>>>> foobaz.txt
>>>> 
>>>> right ??
>>>> 
>>>> to achieve that, just use the *.* include pattern
>>>> to catch only the files on roolevel =
>>>> 
>>>> <project default="copy">
>>>>  <target name="copy">
>>>>   <copy todir="C:/flatten">
>>>>    <fileset dir="C:/test" includes="*.*" />
>>>>   </copy>
>>>> </target>
>>>> </project>
>>>> 
>>>> 
>>>> Regards, Gilbert
>>>> 
>>>> 
>---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>>> For additional commands, e-mail: user-help@ant.apache.org
>>>> 
>>>> 
>>>> 
>>>
>>>-- 
>>>View this message in context: 
>>>http://www.nabble.com/Copying-Folder-tp21124245p21138187.html
>>>Sent from the Ant - Users mailing list archive at Nabble.com.
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>>For additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>> 
>> 
>> 
>
>-- 
>View this message in context: 
>http://www.nabble.com/Copying-Folder-tp21124245p21141650.html
>Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: AW: AW: Copying Folder

Posted by blazingwolf7 <bl...@gmail.com>.
I gave up and decide just to used the copy to copy the files
   	 <copy todir="${build.dir}">
    		<fileset dir="${basedir}">
					<include name="host.txt"/>
					<include name="urls_re"/>
					<include name="urls"/>
    		</fileset>
           </copy> 

But here I faced another problem again...if one of the file is missing..it
won't come out error. Is there anywhere I can do to stop the process if a
file fail to be copy?



Jan.Materne wrote:
> 
> You could <fileset dir="" includesfile=""/> or <filelist>.
> 
> Jan
> 
>>-----Ursprüngliche Nachricht-----
>>Von: blazingwolf7 [mailto:blazingwolf7@gmail.com] 
>>Gesendet: Dienstag, 23. Dezember 2008 02:37
>>An: user@ant.apache.org
>>Betreff: RE: AW: Copying Folder
>>
>>
>>Yes..thank you this is a good solution. But now I have a 
>>different thought.
>>Can I for example prepare a list, then in the list I will 
>>specify what file
>>I want to transfer from the root directory to the new folder.
>>
>>Then it will refer to the file to determine which file to copy 
>>and which
>>file not to transfer.
>>Can that be done?
>>
>>Rebhan, Gilbert wrote:
>>> 
>>> 
>>> 
>>> -----Original Message-----
>>> From: blazingwolf7 [mailto:blazingwolf7@gmail.com]
>>> Sent: Monday, December 22, 2008 10:12 AM
>>> To: user@ant.apache.org
>>> Subject: Re: AW: Copying Folder
>>> 
>>> /*
>>> Not really...I just want to copy the files from the root directory
>>> But the root directory will have folders as well. Now the 
>>problem I faced
>>> is
>>> how to filter out all the folders so that it only copy the 
>>files from the
>>> root directory
>>> */
>>> 
>>> after reading again, i believe you mean =
>>> 
>>> a given folderstructure like that =
>>> 
>>> c:\test>tree /F /A
>>> 
>>> C:.
>>> |   foo.txt
>>> |   foobar.txt
>>> |   foobaz.txt
>>> |
>>> +---sub
>>> |   \---subsub
>>> |           sub.txt
>>> |
>>> \---sub1
>>>     \---subsub
>>>             sub1.txt
>>> ...
>>> 
>>> and you want to copy only the files on rootlevel
>>> foo.txt
>>> foobar.txt
>>> foobaz.txt
>>> 
>>> right ??
>>> 
>>> to achieve that, just use the *.* include pattern
>>> to catch only the files on roolevel =
>>> 
>>> <project default="copy">
>>>  <target name="copy">
>>>   <copy todir="C:/flatten">
>>>    <fileset dir="C:/test" includes="*.*" />
>>>   </copy>
>>> </target>
>>> </project>
>>> 
>>> 
>>> Regards, Gilbert
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>> 
>>> 
>>> 
>>
>>-- 
>>View this message in context: 
>>http://www.nabble.com/Copying-Folder-tp21124245p21138187.html
>>Sent from the Ant - Users mailing list archive at Nabble.com.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>For additional commands, e-mail: user-help@ant.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Copying-Folder-tp21124245p21141650.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: AW: Copying Folder

Posted by Ja...@rzf.fin-nrw.de.
You could <fileset dir="" includesfile=""/> or <filelist>.

Jan

>-----Ursprüngliche Nachricht-----
>Von: blazingwolf7 [mailto:blazingwolf7@gmail.com] 
>Gesendet: Dienstag, 23. Dezember 2008 02:37
>An: user@ant.apache.org
>Betreff: RE: AW: Copying Folder
>
>
>Yes..thank you this is a good solution. But now I have a 
>different thought.
>Can I for example prepare a list, then in the list I will 
>specify what file
>I want to transfer from the root directory to the new folder.
>
>Then it will refer to the file to determine which file to copy 
>and which
>file not to transfer.
>Can that be done?
>
>Rebhan, Gilbert wrote:
>> 
>> 
>> 
>> -----Original Message-----
>> From: blazingwolf7 [mailto:blazingwolf7@gmail.com]
>> Sent: Monday, December 22, 2008 10:12 AM
>> To: user@ant.apache.org
>> Subject: Re: AW: Copying Folder
>> 
>> /*
>> Not really...I just want to copy the files from the root directory
>> But the root directory will have folders as well. Now the 
>problem I faced
>> is
>> how to filter out all the folders so that it only copy the 
>files from the
>> root directory
>> */
>> 
>> after reading again, i believe you mean =
>> 
>> a given folderstructure like that =
>> 
>> c:\test>tree /F /A
>> 
>> C:.
>> |   foo.txt
>> |   foobar.txt
>> |   foobaz.txt
>> |
>> +---sub
>> |   \---subsub
>> |           sub.txt
>> |
>> \---sub1
>>     \---subsub
>>             sub1.txt
>> ...
>> 
>> and you want to copy only the files on rootlevel
>> foo.txt
>> foobar.txt
>> foobaz.txt
>> 
>> right ??
>> 
>> to achieve that, just use the *.* include pattern
>> to catch only the files on roolevel =
>> 
>> <project default="copy">
>>  <target name="copy">
>>   <copy todir="C:/flatten">
>>    <fileset dir="C:/test" includes="*.*" />
>>   </copy>
>> </target>
>> </project>
>> 
>> 
>> Regards, Gilbert
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>> 
>> 
>> 
>
>-- 
>View this message in context: 
>http://www.nabble.com/Copying-Folder-tp21124245p21138187.html
>Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: AW: Copying Folder

Posted by blazingwolf7 <bl...@gmail.com>.
Yes..thank you this is a good solution. But now I have a different thought.
Can I for example prepare a list, then in the list I will specify what file
I want to transfer from the root directory to the new folder.

Then it will refer to the file to determine which file to copy and which
file not to transfer.
Can that be done?

Rebhan, Gilbert wrote:
> 
> 
> 
> -----Original Message-----
> From: blazingwolf7 [mailto:blazingwolf7@gmail.com]
> Sent: Monday, December 22, 2008 10:12 AM
> To: user@ant.apache.org
> Subject: Re: AW: Copying Folder
> 
> /*
> Not really...I just want to copy the files from the root directory
> But the root directory will have folders as well. Now the problem I faced
> is
> how to filter out all the folders so that it only copy the files from the
> root directory
> */
> 
> after reading again, i believe you mean =
> 
> a given folderstructure like that =
> 
> c:\test>tree /F /A
> 
> C:.
> |   foo.txt
> |   foobar.txt
> |   foobaz.txt
> |
> +---sub
> |   \---subsub
> |           sub.txt
> |
> \---sub1
>     \---subsub
>             sub1.txt
> ...
> 
> and you want to copy only the files on rootlevel
> foo.txt
> foobar.txt
> foobaz.txt
> 
> right ??
> 
> to achieve that, just use the *.* include pattern
> to catch only the files on roolevel =
> 
> <project default="copy">
>  <target name="copy">
>   <copy todir="C:/flatten">
>    <fileset dir="C:/test" includes="*.*" />
>   </copy>
> </target>
> </project>
> 
> 
> Regards, Gilbert
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Copying-Folder-tp21124245p21138187.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: AW: Copying Folder

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.

-----Original Message-----
From: blazingwolf7 [mailto:blazingwolf7@gmail.com]
Sent: Monday, December 22, 2008 10:12 AM
To: user@ant.apache.org
Subject: Re: AW: Copying Folder

/*
Not really...I just want to copy the files from the root directory
But the root directory will have folders as well. Now the problem I faced is
how to filter out all the folders so that it only copy the files from the
root directory
*/

after reading again, i believe you mean =

a given folderstructure like that =

c:\test>tree /F /A

C:.
|   foo.txt
|   foobar.txt
|   foobaz.txt
|
+---sub
|   \---subsub
|           sub.txt
|
\---sub1
    \---subsub
            sub1.txt
...

and you want to copy only the files on rootlevel
foo.txt
foobar.txt
foobaz.txt

right ??

to achieve that, just use the *.* include pattern
to catch only the files on roolevel =

<project default="copy">
 <target name="copy">
  <copy todir="C:/flatten">
   <fileset dir="C:/test" includes="*.*" />
  </copy>
</target>
</project>


Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: AW: Copying Folder

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
-----Ursprüngliche Nachricht-----
Von: blazingwolf7 [mailto:blazingwolf7@gmail.com]
Gesendet: Montag, 22. Dezember 2008 10:12
An: user@ant.apache.org
Betreff: Re: AW: Copying Folder

/*
Not really...I just want to copy the files from the root directory
But the root directory will have folders as well. Now the problem I faced is
how to filter out all the folders so that it only copy the files from the
root directory
*/

you have to use flatten=true for that purpose,
example with attribute flatten =

<project default="copy">
 <target name="copy">
  <copy flatten="true" todir="C:/flatten">
   <fileset dir="C:/groovy" includes="**/*.*" />
  </copy>
</target>
</project>

will do a recursive copy from all files contained in
c:/groovy but doesn't preserve the directory structure,
means the targetdir C:/flatten will have no subfolders.

Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: AW: Copying Folder

Posted by blazingwolf7 <bl...@gmail.com>.
Not really...I just want to copy the files from the root directory
But the root directory will have folders as well. Now the problem I faced is
how to filter out all the folders so that it only copy the files from the
root directory


Rebhan, Gilbert wrote:
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: blazingwolf7 [mailto:blazingwolf7@gmail.com]
> Gesendet: Montag, 22. Dezember 2008 09:53
> An: user@ant.apache.org
> Betreff: Re: Copying Folder
> 
> /*
> Hmm...there are .txt and other files inside there..
> There are folders as well. I want to ignore all folders and copy the rest
> of
> the files
> But just keep failing to do that. It copy everything
> */
> 
> i think you want to recursive copy, but only the files without preserving
> the directory structure !?
> 
> look at the flatten attribute from copy task or use a flattenmapper
> 
> Regards, Gilbert
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Copying-Folder-tp21124245p21124700.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: Copying Folder

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.

-----Ursprüngliche Nachricht-----
Von: blazingwolf7 [mailto:blazingwolf7@gmail.com]
Gesendet: Montag, 22. Dezember 2008 09:53
An: user@ant.apache.org
Betreff: Re: Copying Folder

/*
Hmm...there are .txt and other files inside there..
There are folders as well. I want to ignore all folders and copy the rest of
the files
But just keep failing to do that. It copy everything
*/

i think you want to recursive copy, but only the files without preserving
the directory structure !?

look at the flatten attribute from copy task or use a flattenmapper

Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Copying Folder

Posted by blazingwolf7 <bl...@gmail.com>.
Hmm...there are .txt and other files inside there..
There are folders as well. I want to ignore all folders and copy the rest of
the files
But just keep failing to do that. It copy everything


Brett Ryan wrote:
> 
> The problem is that your `include' clause is implicitly ignoring
> folders, if you wish to use the include clause add another with the
> value of '*/', otherwise remove <include name="*"/>
> 
> On Mon, Dec 22, 2008 at 7:26 PM, blazingwolf7 <bl...@gmail.com>
> wrote:
>>
>> Hi,
>>
>> I am trying to used ant to copy all files from one folder to another. But
>> from the directory the files to be copy from contains some folders as
>> well.
>>
>> <copy todir="${build.dir}">
>>                <fileset dir="${basedir}">
>>                <include name="*"/>
>>                </fileset>
>> </copy>
>>
>> I tried to copy all the files except for the folders but fail to do so.
>> Can
>> anyone advice?
>> --
>> View this message in context:
>> http://www.nabble.com/Copying-Folder-tp21124245p21124245.html
>> Sent from the Ant - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Copying-Folder-tp21124245p21124520.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Copying Folder

Posted by Brett Ryan <br...@gmail.com>.
The problem is that your `include' clause is implicitly ignoring
folders, if you wish to use the include clause add another with the
value of '*/', otherwise remove <include name="*"/>

On Mon, Dec 22, 2008 at 7:26 PM, blazingwolf7 <bl...@gmail.com> wrote:
>
> Hi,
>
> I am trying to used ant to copy all files from one folder to another. But
> from the directory the files to be copy from contains some folders as well.
>
> <copy todir="${build.dir}">
>                <fileset dir="${basedir}">
>                <include name="*"/>
>                </fileset>
> </copy>
>
> I tried to copy all the files except for the folders but fail to do so. Can
> anyone advice?
> --
> View this message in context: http://www.nabble.com/Copying-Folder-tp21124245p21124245.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Copying Folder

Posted by Brett Ryan <br...@gmail.com>.
My apologies, I think I didn't read the question correctly, Jan is
correct after I read again :)

-Brett

On Mon, Dec 22, 2008 at 7:38 PM,  <Ja...@rzf.fin-nrw.de> wrote:
> includeEmptyDirs="false">

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: Copying Folder

Posted by Ja...@rzf.fin-nrw.de.
<copy includeEmptyDirs="false">

Jan 

>-----Ursprüngliche Nachricht-----
>Von: blazingwolf7 [mailto:blazingwolf7@gmail.com] 
>Gesendet: Montag, 22. Dezember 2008 09:27
>An: user@ant.apache.org
>Betreff: Copying Folder
>
>
>Hi,
>
>I am trying to used ant to copy all files from one folder to 
>another. But
>from the directory the files to be copy from contains some 
>folders as well.
>
><copy todir="${build.dir}">
>    		<fileset dir="${basedir}">
>      		<include name="*"/>
>    		</fileset>
></copy>
>
>I tried to copy all the files except for the folders but fail 
>to do so. Can
>anyone advice?
>-- 
>View this message in context: 
>http://www.nabble.com/Copying-Folder-tp21124245p21124245.html
>Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org