I need to replace all the files contained in a dir with all the files that exists in other.
This would be a pseudo code for this task:
foreach (string file in /foo/var)
{
srcFile = "/other/dir/" + GetFileName(file);
Copy(srcFile, file);
}
I need to replace the file only if exists in both /foo/var and /other/dir. Also there are files that exist in /foo/var and do not exist in /other/dir and vice versa.
What is the best way to do it with NAnt?
This should do the job. It will only look at files in the root target directory and ignore subfolders. It will need a bit more work if you want it to include files in subfolders
I tested it with Nant 0.86