Hi Dean, > what if I want it to be just like java's ant where I am doing a clean target > and I want it to pass if > > The directory already does not exist….ie. clean was successful because it > was already clean > I want it to fail if it tries to delete ${output} and cannot because a file > is locked in that directory.
http://nant.sourceforge.net/nightly/latest/help/tasks/delete.html <delete dir="${output}" if="${directory::exists(output)}"/> default behaviour is true for failonerror, delete should fail if directory is use. Here's small a nant function when you want to selectively work with files which may be in use...in my case I wanted to zip old log files and then delete them, but not log files in use (i.e. the current projects log files or any other nant projects running concurrently): [Function("can-delete-file")] public bool canDeleteFile(string filename) { try { StreamWriter w = File.AppendText(filename); w.Close(); } catch { return false; } return true; } There is no doubt a more elegant way, but this works. peace si