Success!!!

Changed Rob's script to use apply instead of delete

<apply executable="rm" dir="/opt/stratalight/packages" >
    <arg value="-r" />
    <arg value="-f" />
    <dirset dir="/opt/stratalight/packages" excludes="${directories}"
followsymlinks="true">
            <include name="*/**" />
    </dirset>
</apply>

Now it works perfectly.  Out of curiosity - anyone know why??

Tracy

-----Original Message-----
From: Tracy Jones 
Sent: Friday, February 09, 2007 4:28 PM
To: Ant Users List
Subject: RE: at my wits end with delete

Thanks Rob - 

I tried your exact test and it worked fine as well.  Then I just changed
your test.xml to point to my directory and changed the properties file
to my list and it does not work.  There must be something odd about my
directory structure - there are a lot of symbolic links in my
directories so I am wondering it that is an issue?  What I really want
is

rm -rf 

on the directories not in my list.  Perhaps apply would work??


-----Original Message-----
From: Anderson, Rob (Global Trade) [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 09, 2007 3:28 PM
To: Ant Users List
Subject: RE: at my wits end with delete

Hmm, Not sure why there is still a problem. I setup a simple test that
is similar to your situation like this...

mkdir -p test/A test/B test/C test/D test/E
touch test/A/new test/B/new test/C/new test/D/new test/E/new

Then I made the following build.xml...
<project name="test" default="deltest">
<property file="build.properties"/>
<target name="deltest">
<delete includeemptydirs="true" >
  <fileset dir="test" excludes="${directories}">
          <include name="*/**"/>
  </fileset>
</delete>
</target>
</project>

And a build.properties file...
directories=A/**\ B/**\ C/**

Running ant -debug deltest shows it working OK for me...
fileset: Setup scanner in dir C:\cygwin\home\rob\test with patternSet{
includes: [*/**] excludes: [A/**, B/**, C/**] }
   [delete] Deleting 2 files from C:\cygwin\home\rob\test
   [delete] Deleting C:\cygwin\home\rob\test\D\new
   [delete] Deleting C:\cygwin\home\rob\test\E\new
   [delete] Deleting C:\cygwin\home\rob\test\E
   [delete] Deleting C:\cygwin\home\rob\test\D
   [delete] Deleted 2 directories from C:\cygwin\home\rob\test

Perhap there is nothing to delete that is not excluded?
-Rob Anderson


> -----Original Message-----
> From: Tracy Jones [mailto:[EMAIL PROTECTED] 
> Sent: Friday, February 09, 2007 3:09 PM
> To: Ant Users List
> Subject: RE: at my wits end with delete
> 
> Ok - thanks for the help!!  I made the changes that everyone suggested
> and now it does not delete anything at all (which is better in a way)
> 
> changed my exclude to excludes (but it's a space separated 
> list which is
> read from a properties file) - this is what it looks like in the
> properties file
> 
> directories=OS-4000-1.6(B18)Beta/**\ OTS-SC-1.6(B18)Beta/**\
> OTS-4010-1.6(B17)Beta/**\ OTS-4040-1.6(B17)Beta/**\
> OTS-4400-1.6(B17)Beta
> /**\ OTS-4540-1.6(B17)Beta/**\ OTS-4520-1.6(B17)Beta/**\
> OTS-Common-1.6(B18)Beta/**\ OTS-4011-1.6(B17)Beta/**
> 
> Here's the new output from the run
> 
> fileset: Setup scanner in dir /opt/stratalight/packages with 
> patternSet{
> includes: [*/**] excludes: [OS-4000-1.6(B18)Beta/**,
> OTS-SC-1.6(B18)Beta/**, OTS-4010-1.6(B17)Beta/**,
> OTS-4040-1.6(B17)Beta/**, OTS-4400-1.6(B17)Beta/**,
> OTS-4540-1.6(B17)Beta/**, OTS-4520-1.6(B17)Beta/**,
> OTS-Common-1.6(B18)Beta/**, OTS-4011-1.6(B17)Beta/**] }
> 
> 
> here's the new code snippet
> 
> <delete includeemptydirs="true" >
>   <fileset dir="${installation.dir}" excludes="${directories}">
>         <include name="*/**"/>
>   </fileset>
> </delete>
> 
> 
> I also tried changing the space separated to comma separated and still
> no luck :-(
> 
> 
> -----Original Message-----
> From: Anderson, Rob (Global Trade) [mailto:[EMAIL PROTECTED] 
> Sent: Friday, February 09, 2007 2:51 PM
> To: Ant Users List
> Subject: RE: at my wits end with delete
> 
> The excludes should be comma seperated. It's difficult to 
> tell from your
> post whether or not that is the case. Please send the part of your
> build.xml that defines the excludes. 
> 
> -Rob Anderson
> 
> > -----Original Message-----
> > From: Tracy Jones [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, February 09, 2007 2:45 PM
> > To: Ant Users List
> > Subject: at my wits end with delete
> > 
> >  
> > 
> > I just cannot get this right
> > 
> >  
> > 
> > I have set up my fileset to exclude a list of directories and delete
> > everything else
> > 
> >  
> > 
> > fileset: Setup scanner in dir /opt/stratalight/packages with 
> > patternSet{
> > includes: [*/**] excludes: [OS-4000-1.6(B18)Beta/**
> > OTS-SC-1.6(B18)Beta/** OTS-4010-1.6(B17)Beta/** 
> > OTS-4040-1.6(B17)Beta/**
> > OTS-4400-1.6(B17)Beta/** OTS-4540-1.6(B17)Beta/**
> > OTS-4520-1.6(B17)Beta/** OTS-Common-1.6(B18)Beta/**
> > OTS-4011-1.6(B17)Beta/**] }
> > 
> >    [delete] Deleting
> > /opt/stratalight/packages/OS-4000-1.6(B18)Beta/OTS-4010/client
> > Fpga4010.s
> > lim
> > 
> >  
> > 
> > But (as you can see) the first thing it deletes is 
> something under one
> > of my excluded directories.  Can someone please point out what I am
> > doing wrong???  Thanks
> > 
> >  
> > 
> > Tracy
> > 
> >  
> > 
> > (ant 1.7.0)
> > 
> >  
> > 
> > Here's the snippet of code 
> > 
> >  
> > 
> > ${directories} is OS-4000-1.6(B18)Beta/** OTS-SC-1.6(B18)Beta/**
> > OTS-4010-1.6(B17)Beta/** OTS-4040-1.6(B17)Beta/**
> > OTS-4400-1.6(B17)Beta/** OTS-4540-1.6(B17)Beta/**
> > OTS-4520-1.6(B17)Beta/** OTS-Common-1.6(B18)Beta/**
> > OTS-4011-1.6(B17)Beta/**
> > 
> >  
> > 
> > <delete includeemptydirs="true" >^M
> > 
> >                         <fileset dir="${installation.dir}"
> > casesensitive="yes">
> > 
> >                 <exclude name="${directories}"/>
> > 
> >                 <include name="*/**"/>
> > 
> >             </fileset>
> > 
> > </delete>^M
> > 
> >  
> > 
> >  
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to