Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

How to Check if Directory exists?

Brill, C

2008-09-09

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi,

I've got a little problem.
Here is the existing directory structure:

drwxrwxr-x  5 symosyad  edasql       96 Sep 9 13:14 DWH-PQ-HQ-0837
-rw-r-----  1 symosyad  edasql     3760 Sep 9 13:14
DWH-PQ-HQ-0837_Lieferung.tar.gz
drwxr-xr-x  3 symosyad  edasql       96 Sep 9 13:12 archiv

In one of the first steps in my build.xml I want to check if the file
'DWH-PQ-HQ-0837_Lieferung.tar.gz' and the directory 'DWH-PQ-HQ-0837'
exist.
If the exist I want to move them into 'archiv'.
With the <available> task I can only check if files exists, isn't it?
Here is the target from my build.xml:

<target name="archiv" description="move last delivery into archiv ...">
 <!-- copy recent packages to archiv -->
 <copy todir="${name.dir.archiv}">
   <fileset dir="${name.dir.projekt}">
       <include name="**"/>
       <exclude name="archiv"/>
     </fileset>
   </copy>
   <!-- clean directory ${name.dir.projekt} -->
   <dirset id="deldir" dir="${name.dir.projekt}">
     <include name="*"/>
     <exclude name="archiv"/>
   </dirset>
   <delete>
   <fileset dir="${name.dir.projekt}">
     <include name="*.gz"/>
   </fileset>
 </delete>
   <for delimiter=";" list="${toString:deldir}" param="name.dir">
     <sequential>
       <delete
dir="${name.dir.projekt}/@(protected)}"/>
     </sequential>
 </for>
</target>

Thanks for your help!

Christoph


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.