Take a look at the available task, that should give you what you need ... Gert
----- Original Message ----- From: "Bill Conroy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; "Hearn, Bruce" <[EMAIL PROTECTED]> Sent: Friday, March 14, 2003 11:52 PM Subject: Re: [Nant-users] file existence task? > I just tried to achieve the same thing today...I did this: > > <foreach item="Folder" in="${nant.project.basedir}" property="foldername"> > <script language="C#"> > <code> > <![CDATA[ > public static void ScriptMain(Project project_) { > string folder = (string)project_.Properties["foldername"]; > Console.Out.WriteLine("Checking for " + folder + @"\make.build"); > bool bExists = System.IO.File.Exists(folder + @"\make.build"); > if (bExists) > { > Console.Out.WriteLine("Found file " + folder + @"\make.build"); > } > > if (bExists) > { > project_.Execute("build"); // this builds the sub file > } > } > ]]> > </code> > </script> > </foreach> > > If there is a better way I'd love to know. > > Thanks > -bc > > ---------- Original Message ---------------------------------- > From: "Hearn, Bruce" <[EMAIL PROTECTED]> > Date: Fri, 14 Mar 2003 13:13:32 -0800 > > > > >is there a way to check for the existence of a file or directory on disk? > > > >To elaborate, I use batch scripts a lot and would like to move everything to > >Nant. In batch, I can do things like this: > > > > if exists "c:\somedir\somefile.txt" echo the file exists! > >or: > > if exists r:\ ( > > echo removed existing mapping > > subst /d r: > > ) else ( > > echo mapping will be created from scratch > > ) > > subst r: %codeline% > > > >I looked at the "if" task but it doesn't seem to have this capability. Has > >anyone done this kind of stuff? > > > >thanks, > > > >Bruce > > > > > >------------------------------------------------------- > >This SF.net email is sponsored by:Crypto Challenge is now open! > >Get cracking and register here for some mind boggling fun and > >the chance of winning an Apple iPod: > >http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > >_______________________________________________ > >Nant-users mailing list > >[EMAIL PROTECTED] > >https://lists.sourceforge.net/lists/listinfo/nant-users > > > > > ------------------------------------------------------- > This SF.net email is sponsored by:Crypto Challenge is now open! > Get cracking and register here for some mind boggling fun and > the chance of winning an Apple iPod: > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > _______________________________________________ > Nant-users mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/nant-users > ------------------------------------------------------- This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users