ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peter.rei...@corvil.com>
Subject Re: Deleting only the contents of a directory
Date Mon, 21 Jun 2004 16:32:56 GMT
Hi, you need to do:
    <delete includeEmptyDirs="yes">
      <fileset dir="dir" includes="*"/>
    </delete>

as in:
  <target name="del">
    <delete quiet="yes" dir="dir"/>
    <ac:shellscript shell="bash">
      mkdir dir
      mkdir dir/subdir
      touch dir/file
    </ac:shellscript>
    <delete includeEmptyDirs="yes">
      <fileset dir="dir" includes="*"/>
    </delete>
    <ac:shellscript shell="bash">
      ls -l dir
    </ac:shellscript>
  </target>

Peter
Ivan Ivanov wrote:

>Hi Luis and Neta,
>
>I checked your examples, which are virtually same and
>the result is that they delete all the files in the
>all the subdirectories, and leave the subdirectories.
>My aim is to remove all the files and all
>subdirectories without the root directory.
>
>Thank you very much for your help
>
>Ivan
>
>--- luis.conelly@ge.com wrote:
>  
>
>>This is the target which implemented the other one:
>>
>>       <antcall target="cleanup">
>>           <param name="param.build"
>>value="${build}"/>
>>           <param name="param.cleanup.list"
>>value="**/*"/> 
>>       </antcall>
>>
>>
>>HTH
>>-----Original Message-----
>>From: Conelly, Luis (GE Energy, Non GE) 
>>Sent: Monday, June 21, 2004 11:02 AM
>>To: 'Ant Users List'
>>Subject: RE: Deleting only the contents of a
>>directory
>>
>>
>>I used to use:
>>
>>   <target name="cleanup" >
>>       <delete>
>>           <fileset dir="${param.build}"
>>includes="${param.cleanup.list}" />
>>       </delete>
>>   </target>
>>
>>the param.cleanup.list was **/*
>>
>>That dropped all my compiled classes but left the
>>root directory for the
>>classes.
>>
>>I might think (without having a look at the manual)
>>that the
>>[includeemptydirs="true"] is giving you a hard
>>time... but of course, I
>>might be wrong ;-)
>>
>>Hope this helps...
>>
>>Regards
>>Luis
>>
>>-----Original Message-----
>>From: Ivan Ivanov
>>[mailto:rambiusparkisanius@yahoo.com]
>>Sent: Monday, June 21, 2004 10:51 AM
>>To: user@ant.apache.org
>>Subject: Deleting only the contents of a directory
>>
>>
>>Dear Colleagues,
>>
>>I want to delete the contents of a directory without
>>the very directory. I tried some variants but wth no
>>luck like this
>>
>><delete failonerror="false" includeemptydirs="true">
>>	
>>   <fileset dir="${project.bin}">
>>       <include name="**"/>
>>       <exclude name="${project.bin.name}"/>
>>   </fileset>
>></delete>
>>
>>I want to delete all files and dirs in
>>${project.bin}
>>without ${project.bin}$. I suppose it is something
>>easy but I still do not see it. Any hints?
>>
>>Ivan
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Tired of spam?  Yahoo! Mail has the best spam
>>protection around 
>>http://mail.yahoo.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
>>
>>
>>    
>>
>
>
>
>		
>__________________________________
>Do you Yahoo!?
>Yahoo! Mail - Helps protect you from nasty viruses.
>http://promotions.yahoo.com/new_mail
>
>---------------------------------------------------------------------
>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


Mime
View raw message