Bugs item #1495507, was opened at 2006-05-26 07:59 Message generated for change (Comment added) made by eberhard You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1495507&group_id=31650
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Tasks Group: 0.85 Status: Open Resolution: None Priority: 5 Submitted By: Eberhard Beilharz (eberhard) Assigned to: Nobody/Anonymous (nobody) Summary: foreach task with IN element retrieves parent folder Initial Comment: The "in" element inside of the foreach task seems to have a problem: I'm trying to delete all subfolders under dir1. However, no matter what I specify as include (with/without wildcard...), either none of the subdirectories gets deleted, or all including dir1 gets deleted. This used to work in NAnt 0.84. If I use the "in" attribute it works as expected. Directory structure: tmp\dir1 tmp\dir1\dir2 tmp\dir1\dir3 The following deletes dir1, dir2 and dir3, but should delete only dir2 and dir3: <foreach item="Folder" property="foldername"> <in> <items> <include name="dir1\*"/> </items> </in> <do> <delete dir="${foldername}" failonerror="false" /> </do> </foreach> See attachment for a build file that demonstrates this bug. By the way, I'm using the nightly build 2006-04-30. ---------------------------------------------------------------------- >Comment By: Eberhard Beilharz (eberhard) Date: 2006-05-30 08:58 Message: Logged In: YES user_id=695643 <include name="./?*" /> still matches the basedir in the latest nightly build. The workaround works, but gets a little tedious if you have multiple include lines. But it's only a workaround... Thanks! ---------------------------------------------------------------------- Comment By: Gary Feldman (garyfx) Date: 2006-05-28 10:19 Message: Logged In: YES user_id=847172 OK, I'm convinced to an extent. More precisely, the pattern: <include name="./?*" /> should not match the basedir, but does (though I've only checked a version nearly a year old, 24 July 2005). The pattern <include name="./*" /> should match "./", at least as documented, and hence this is working. However, it is confusing. I also think the implied ** for patterns ending in / or \ is confusing, and should be removed as unnecessary. A shortcut that only saves two characters isn't worth the trouble. As a workaround, try: <items basedir="."> <include name="dir1/*" /> <exclude name="dir1" /> </items> ---------------------------------------------------------------------- Comment By: Eberhard Beilharz (eberhard) Date: 2006-05-27 15:28 Message: Logged In: YES user_id=695643 Using basedir doesn't help. I still get dir1 and dir2. ---------------------------------------------------------------------- Comment By: Gary Feldman (garyfx) Date: 2006-05-26 11:47 Message: Logged In: YES user_id=847172 Try using the basedir attribute for the fileset, i.e. <items basedir="dir1"> <include name="*/> </items> The <foreach><in><items> is behaving as documented. That's because * matches zero or more characters, and hence the pattern "dir1\*" matches "dir1\", which means the dir1 directory will be returned. Feel free to reopen if the above suggestion doesn't work. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1495507&group_id=31650 ------------------------------------------------------- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 _______________________________________________ nant-developers mailing list nant-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-developers