It you use Include name="**" that will (should) include all files in all
directories. 

BOb

> -----Original Message-----
> From: Parrish, Ken [mailto:kparr...@gomez.com]
> Sent: Tuesday, January 06, 2009 5:56 PM
> To: Bob Archer; Brass Tilde; nant-users@lists.sourceforge.net
> Subject: RE: [NAnt-users] Delete files but preserve directory tree
> 
> Bob,
> 
> Yes, '*' matches all files, but will also match all directory names
and
> the net result is to delete the entire directory tree.
> 
> What I want to do is to recursively delete all the files in a
directory
> tree WITHOUT deleting any of the directories themselves.  In addition,
> it would be extremely helpful to be able to apply <fileset> or
> <patternset> filtering to the deletion of files.
> 
> In effect, <delete> that operates recursively ONLY on files, NOT on
> directory nodes.
> 
> Ken
> 
> -----Original Message-----
> From: Bob Archer [mailto:bob.arc...@amsi.com]
> Sent: Tuesday, January 06, 2009 4:35 PM
> To: Parrish, Ken; Brass Tilde; nant-users@lists.sourceforge.net
> Subject: RE: [NAnt-users] Delete files but preserve directory tree
> 
> Rather than using *.* use * ... that will match any filename with or
> without an extension.
> 
> I guess I don't understand why you can just exclude your config file
> names. If they are in a directory the directory won't be deleted.
> 
> BOb
> 
> 
> 
> > -----Original Message-----
> > From: Parrish, Ken [mailto:kparr...@gomez.com]
> > Sent: Tuesday, January 06, 2009 2:35 PM
> > To: Brass Tilde; nant-users@lists.sourceforge.net
> > Subject: Re: [NAnt-users] Delete files but preserve directory tree
> >
> > Nant Users,
> >
> > Thanks for your feedback on this.  I've replied to this list a
couple
> of
> > time, but my posting keep getting bounced.
> >
> > The addition of a filesOnly and/or directoriesOnly attribute to a
> > <fileset> would greatly simplify file operations which need to be
> > applied to one or the other, yet still allow for the power and
> > flexibility of the <fileset> element.
> >
> > Below it what I devised.  It works well except that the *.* file
> filter
> > excludes files that might not have an extension.  Not a huge problem
> in
> > the Windows world that I employ, but still a limitation.
> >
> > However, the filesOnly parameter to the <fileset> as described above
> > would likely allow this task to reduce to a single <delete> element.
> >
> > Thanks,
> >
> > Ken Parrish
> > Gomez, Inc.
> >
> >     <!--
> >             PurgeDirectory
> >                     Recursively removes file from a directory tree
> > preserving the directory tree.
> >
> >             Parameters:
> >                     PurgeDirectory_dir                      path
> > name of directory to purge
> >     -->
> >     <target name="PurgeDirectory" >
> >
> >         <echo message="PurgeDirectory = ${PurgeDirectory_dir}" />
> >
> >             <delete>
> >                     <fileset basedir="${PurgeDirectory_dir}">
> >                             <include name="*.*" />
> >
> >                             <!-- Add exclusions here -->
> >                     </fileset>
> >             </delete>
> >
> >             <foreach item="Folder" in="${PurgeDirectory_dir}"
> > property="dirname">
> >                     <property name="PurgeDirectory_dir"
> > value="${dirname}" />
> >                     <call target="PurgeDirectory" />
> >             </foreach>
> >     </target>
> >
> >
> >
> >
> > -----Original Message-----
> > From: Brass Tilde [mailto:brassti...@gmail.com]
> > Sent: Tuesday, January 06, 2009 11:24 AM
> > To: nant-users@lists.sourceforge.net
> > Subject: Re: [NAnt-users] Delete files but preserve directory tree
> >
> > > IF this a consistent directory tree? If so, just exclude the
> > directories
> > > from the delete. If not I think you should be able to use a
foreach
> to
> > loop
> > > over a fileset and delete each individual files. But, I don't know
> how
> > good
> > > the performance on this will be.
> >
> > Would the effort of adding a "filesOnly" attribute to the fileset
> > object be worth the time and effort?
> >
> > Brad
> >
> >
>
------------------------------------------------------------------------
> > ------
> > Check out the new SourceForge.net Marketplace.
> > It is the best place to buy or sell services for
> > just about anything Open Source.
> > http://p.sf.net/sfu/Xq1LFB
> > _______________________________________________
> > NAnt-users mailing list
> > NAnt-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nant-users
> >
> >
>
------------------------------------------------------------------------
> --
> > ----
> > Check out the new SourceForge.net Marketplace.
> > It is the best place to buy or sell services for
> > just about anything Open Source.
> > http://p.sf.net/sfu/Xq1LFB
> > _______________________________________________
> > NAnt-users mailing list
> > NAnt-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nant-users

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to