Index: other-projects/trunk/anttasks/build.xml
===================================================================
--- other-projects/trunk/anttasks/build.xml	(revision 17899)
+++ other-projects/trunk/anttasks/build.xml	(revision 17902)
@@ -75,4 +75,14 @@
 		</rsr>
 
+		<!-- test 5 -->
+		<copy file="src/test/rsr.txt" tofile="test/rsr5-1.txt"/>
+		<copy file="src/test/rsr.txt" tofile="test/rsr5-2.txt"/>
+		<rsr>
+			<fileset dir="test" includes="rsr5-*"/>
+			<job pattern="@path@" replacement="C:\Program Files\Greenstone 2.80"/>
+			<job pattern="@path-with-winpath@" replacement="C:\Program Files\Greenstone 2.80" winPath="true"/>
+		</rsr>
+
+
 	</target>
 
Index: other-projects/trunk/anttasks/src/org/greenstone/anttasks/RegexSearchReplace.java
===================================================================
--- other-projects/trunk/anttasks/src/org/greenstone/anttasks/RegexSearchReplace.java	(revision 17899)
+++ other-projects/trunk/anttasks/src/org/greenstone/anttasks/RegexSearchReplace.java	(revision 17902)
@@ -27,4 +27,6 @@
 import java.io.*;
 import java.util.regex.*;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.DirectoryScanner;
 
 public class RegexSearchReplace extends Task {
@@ -32,4 +34,5 @@
 	private File file = null;
 	private ArrayList jobs = null;
+	private FileSet fileset = null;
 	private String pattern = null;
 	private String replacement = null;
@@ -49,10 +52,16 @@
 	public void execute() {
 
-		if ( file == null ) {
-			throw new BuildException( "Error - No file specified !!" );
-		}
-
-		if ( !file.exists() ) {
+		if ( file == null && fileset == null ) {
+			throw new BuildException( "Error - No file or fileset specified !!" );
+		}
+
+		if ( file != null && !file.exists() ) {
 			throw new BuildException( "Error - File not found !!" );
+		}
+
+		DirectoryScanner dirScanner = null;
+		if ( fileset != null ) {
+			dirScanner = fileset.getDirectoryScanner();
+			dirScanner.scan();
 		}
 
@@ -80,5 +89,26 @@
 		}
 
-		System.out.println( "Replace in file: " + file );
+
+		//sus out filename(s)
+		File[] files = null;
+		if ( file != null ) {
+			files = new File[1];
+			files[0] = file;
+		} else {
+			String[] fileStrings = dirScanner.getIncludedFiles();
+			files = new File[fileStrings.length];
+			for ( int i=0; i<fileStrings.length; i++ ) {
+				files[i] = new File( dirScanner.getBasedir() + File.separator + fileStrings[i] );
+			}
+		}
+
+		//output greeting
+		System.out.println();
+		System.out.println( "--------------------" );
+		System.out.println( " RegexSearchReplace " );
+		System.out.println( "--------------------" );
+
+		//output replacement(s)
+		System.out.println( "Replacements:" );
 		if ( pattern != null ) {
 			System.out.println( " " + pattern + " -> " + replacement );
@@ -89,125 +119,150 @@
 		}
 
-		int noReplaces = 0;
-
-		//create the output stream
-		BufferedWriter out = null;
-		File temp = null;
-		try {
-			//create temp file.
-			temp = File.createTempFile("rsr", ".tmp");
-
-			//delete temp file when program exits.
-			temp.deleteOnExit();
-
-			//writer to temp file
-			out = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(temp), "UTF8") );
-
-		} catch (IOException e) {
-			throw new BuildException( "Error - Couldn't create or open the temp file" );
-		}
-
-
-		//create the input stream
-		BufferedReader in = null;
-		try {
-			in = new BufferedReader( new InputStreamReader(new FileInputStream(file), "UTF8") );
-		} catch ( Exception e ) {
-			throw new BuildException( "Error - Couldn't open the specified file" );
-		}
-
-		//pass the file through, searching and replacing
-		String line = null;
-		boolean hasMoreLines = true;
-		while ( hasMoreLines ) {
-
-			try {
-				line = in.readLine();
+		//output filename(s)
+		/*
+		if ( file != null ) {
+			System.out.println( "Replace in file: " + file );
+		} else {
+			System.out.println( "Replace in files:" );
+			for ( int i = 0; i < files.length; i++ ) {
+				System.out.println(files[i]);
+			}
+		}
+		*/
+
+
+		System.out.println( "Files: " );
+		for ( int fileIndex=0; fileIndex<files.length; fileIndex++ ) {
+
+			int noReplaces = 0;
+
+			File inputFile = files[fileIndex];
+
+			//create the output stream
+			BufferedWriter out = null;
+			File temp = null;
+			try {
+				//create temp file.
+				temp = File.createTempFile("rsr", ".tmp");
+
+				//delete temp file when program exits.
+				temp.deleteOnExit();
+
+				//writer to temp file
+				out = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(temp), "UTF8") );
+
+			} catch (IOException e) {
+				throw new BuildException( "Error - Couldn't create or open the temp file" );
+			}
+
+
+			//create the input stream
+			BufferedReader in = null;
+			try {
+				in = new BufferedReader( new InputStreamReader(new FileInputStream(inputFile), "UTF8") );
 			} catch ( Exception e ) {
-				System.err.println( e.getMessage() );
-				throw new BuildException( "Error - Couldn't read from the specified file" );
-			}
-
-			if ( line == null ) {
-				hasMoreLines = false;
-			} else {
-
-				String oldLine = line;
-				if ( pattern != null ) {
-					String rp = replacement;
-					if ( winPath ) {
-						rp = rp.replaceAll("\\\\","\\\\\\\\");
-					}
-					line = line.replaceAll((String)pattern, (String)rp);
+				throw new BuildException( "Error - Couldn't open the specified file" );
+			}
+
+			//pass the file through, searching and replacing
+			String line = null;
+			boolean hasMoreLines = true;
+			while ( hasMoreLines ) {
+
+				try {
+					line = in.readLine();
+				} catch ( Exception e ) {
+					System.err.println( e.getMessage() );
+					throw new BuildException( "Error - Couldn't read from the specified file" );
+				}
+
+				if ( line == null ) {
+					hasMoreLines = false;
 				} else {
-					for ( int i=0; i<jobs.size(); i++ ) {
-						String rp = ((RegexSearchReplaceJob)(jobs.get(i))).getReplacement();
-						if ( ((RegexSearchReplaceJob)(jobs.get(i))).getWinPath() ) {
+
+					String oldLine = line;
+					if ( pattern != null ) {
+						String rp = replacement;
+						if ( winPath ) {
 							rp = rp.replaceAll("\\\\","\\\\\\\\");
 						}
-						line = line.replaceAll( ((RegexSearchReplaceJob)(jobs.get(i))).getPattern(), rp );
+						line = line.replaceAll((String)pattern, (String)rp);
+					} else {
+						for ( int i=0; i<jobs.size(); i++ ) {
+							String rp = ((RegexSearchReplaceJob)(jobs.get(i))).getReplacement();
+							if ( ((RegexSearchReplaceJob)(jobs.get(i))).getWinPath() ) {
+								rp = rp.replaceAll("\\\\","\\\\\\\\");
+							}
+							line = line.replaceAll( ((RegexSearchReplaceJob)(jobs.get(i))).getPattern(), rp );
+						}
 					}
-				}
-
-				if ( !oldLine.equals( line ) ) {
-					noReplaces++;
-				}
-
-				try {
-					out.write( line );
-					out.newLine();
-				} catch ( Exception e ) {
-					throw new BuildException( "Error - Couldn't write to the temp file" );
-				}
-			}
-		}
+
+					if ( !oldLine.equals( line ) ) {
+						noReplaces++;
+					}
+
+					try {
+						out.write( line );
+						out.newLine();
+					} catch ( Exception e ) {
+						throw new BuildException( "Error - Couldn't write to the temp file" );
+					}
+				}
+			}
+			
+			try {
+				//close them both up
+				in.close();
+				out.close();
+			} catch ( Exception e ) {
+				throw new BuildException( "Error - Couldn't close a file" );
+			}
+
+
+			//copy the new file (temp) over the original
+			InputStream i;
+			OutputStream o;
+			try {
+				i = new FileInputStream(temp);
+				o = new FileOutputStream(inputFile);
+
+			} catch ( Exception e ) {
+				throw new BuildException( "Error - Couldn't open the temp file" );
+			}
+
+			try {
 		
-		try {
-			//close them both up
-			in.close();
-			out.close();
-		} catch ( Exception e ) {
-			throw new BuildException( "Error - Couldn't close a file" );
-		}
-
-
-		//copy the new file (temp) over the original
-		InputStream i;
-		OutputStream o;
-		try {
-			i = new FileInputStream(temp);
-			o = new FileOutputStream(file);
-
-		} catch ( Exception e ) {
-			throw new BuildException( "Error - Couldn't open the temp file" );
-		}
-
-		try {
-	
-			// Transfer bytes from in to out
-			byte[] buf = new byte[1024];
-			int len;
-			while ((len = i.read(buf)) > 0) {
-			   o.write(buf, 0, len);
-			}
-
-			//close them up
-			i.close();
-			o.close();
-		} catch ( Exception e ) {
-			throw new BuildException( "Error - Couldn't write to the specified file" );
-		}
-
-		if ( noReplaces == 0 ) {
-			System.out.println( "No Changes Made" );
-		} else if ( noReplaces == 1 ) {
-			System.out.println( "Successfully changed 1 line" );
-		} else {
-			System.out.println( "Successfully changed " + noReplaces + " lines" );
-		}
+				// Transfer bytes from in to out
+				byte[] buf = new byte[1024];
+				int len;
+				while ((len = i.read(buf)) > 0) {
+				   o.write(buf, 0, len);
+				}
+
+				//close them up
+				i.close();
+				o.close();
+			} catch ( Exception e ) {
+				throw new BuildException( "Error - Couldn't write to the specified file" );
+			}
+
+		
+			if ( noReplaces == 0 ) {
+				System.out.println( "  " + inputFile + " : No Changes Made" );
+			} else if ( noReplaces == 1 ) {
+				System.out.println( "  " + inputFile + " : Successfully changed 1 line" );
+			} else {
+				System.out.println( "  " + inputFile + " : Successfully changed " + noReplaces + " lines" );
+			}
+
+		}
+		System.out.println();
 
 	}
 
 	public void setFile(File file) {
+		if ( this.fileset != null || this.file != null ) {
+			throw new BuildException( "Error - Only one file or one fileset may be given!!" );
+		}
 		this.file = file;
 	}
@@ -236,3 +291,11 @@
 	}
 
+	public FileSet createFileset() {
+		if ( this.fileset != null || this.file != null ) {
+			throw new BuildException( "Error - Only one file or one fileset may be given!!" );
+		}
+		fileset = new FileSet();
+		return fileset;
+	}
+
 }
