You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Rebhan, Gilbert" <Gi...@huk-coburg.de> on 2005/08/26 09:18:20 UTC

mix of files and dirs ?

Hi,

Problem =

i'm parsing a logfile for stuff that should be deleted. 
Logfile may contain files _and_ directories.
All parsed filenames and directories
are put into a property, property looks like that :

...
<echo>${delfiles}

     [echo] /lib/spatch2.jar,
     [echo] /lib/shotpatch.jar,
     [echo] /lib/spatchcorba.jar,
     [echo] /lib/safir.jar,
     [echo] /lib/shodpatch.jar,
     [echo] /lib/vbjorb.jar,
     [echo] /lib/vbjorb521p11.jar,
     [echo] /conf/,


Later i want to delete all those with a <for> loop
on remote servers.

When looking into the ant manual for delete task,
it has an attribute for file _or_  dir.

Question =

How to achieve something like :

<for list="${delfiles}" param="delfile">
  <sequential>
      <delete file OR dir="@{delfile}" />
  </sequential>
/for>

with a mix of files and directories in my
property ??

Any ideas ?

Gilbert

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


Re: mix of files and dirs ?

Posted by Ninju Bohra <ni...@yahoo.com>.
If you already have the list of fully-qualified
files/directories that need to be deleted you may want
to:

1) Write the list out to a temp file
2) use the includesfile attribute of the <fileset>
element that is nested inside a <delete> task
3) Add a includeEmptyDirs="true" attribute to the
<delete> to insure empty directories are deleted.

In summary, try the following

<delete includeEmptyDirs="true">
   <fileset dir="${basedir}"
includesfile="${delete_list.file}"/>
</delete>

Hope this helps

--- "Rebhan, Gilbert" <Gi...@huk-coburg.de>
wrote:

> 
> Hi,
> 
> Problem =
> 
> i'm parsing a logfile for stuff that should be
> deleted. 
> Logfile may contain files _and_ directories.
> All parsed filenames and directories
> are put into a property, property looks like that :
> 
> ...
> <echo>${delfiles}
> 
>      [echo] /lib/spatch2.jar,
>      [echo] /lib/shotpatch.jar,
>      [echo] /lib/spatchcorba.jar,
>      [echo] /lib/safir.jar,
>      [echo] /lib/shodpatch.jar,
>      [echo] /lib/vbjorb.jar,
>      [echo] /lib/vbjorb521p11.jar,
>      [echo] /conf/,
> 
> 
> Later i want to delete all those with a <for> loop
> on remote servers.
> 
> When looking into the ant manual for delete task,
> it has an attribute for file _or_  dir.
> 
> Question =
> 
> How to achieve something like :
> 
> <for list="${delfiles}" param="delfile">
>   <sequential>
>       <delete file OR dir="@{delfile}" />
>   </sequential>
> /for>
> 
> with a mix of files and directories in my
> property ??
> 
> Any ideas ?
> 
> Gilbert
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 






		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

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