Index: /main/trunk/ant-tasks/src/org/greenstone/anttasks/PatternSetToFile.java
===================================================================
--- /main/trunk/ant-tasks/src/org/greenstone/anttasks/PatternSetToFile.java	(revision 23241)
+++ /main/trunk/ant-tasks/src/org/greenstone/anttasks/PatternSetToFile.java	(revision 23242)
@@ -15,8 +15,12 @@
  * PatternSetToFile is an Ant task used to take an Ant PatternSet and output to a
  * file all the files that it encompasses
- * @author sjm84
+ * @author Sam McIntosh
  */
 public class PatternSetToFile extends Task
 {
+	//Sets whether or not only the top-level files and folders
+	//are stored in the output file
+	public boolean _toplevelonly = false;
+	
 	//The file the set will be written to
 	public File _outfile = null;
@@ -48,4 +52,26 @@
 				
 				String[] includedFiles = ds.getIncludedFiles();
+				
+				if(_toplevelonly)
+				{
+					ArrayList toplevel = new ArrayList();
+					
+					for(int j = 0; j < includedFiles.length; j++)
+					{
+						int separatorIndex = includedFiles[j].indexOf(File.separator);
+						
+						if ( separatorIndex == -1 && includedFiles[j].length() > 0 && !toplevel.contains(toplevel)) {
+							toplevel.add(includedFiles[j]);
+						}
+						else if ( separatorIndex > -1 && includedFiles[j].length() > 0) {
+							String path = includedFiles[j].substring(0, separatorIndex);
+							if ( !toplevel.contains(path) ) {
+								toplevel.add(path);
+							}
+						}
+					}
+					includedFiles = (String[])toplevel.toArray(new String[0]);
+				}
+				
 				for (int j = 0; j < includedFiles.length; j++)
 				{
@@ -60,10 +86,15 @@
 		}
 	}
-	
+
+	public void setToplevelonly(boolean toplevelonly)
+	{
+		_toplevelonly = toplevelonly;
+	}
+
 	public void setOutfile(File outfile)
 	{
 		_outfile = outfile;
 	}
-	
+
 	public void setDir(File dir)
 	{
@@ -73,5 +104,5 @@
 	public void addConfiguredPatternset(PatternSet patternset) 
 	{
-		if (patternset == null || !(patternset instanceof PatternSet))
+		if (patternset == null)
 		{
 			return;
Index: /main/trunk/release-kits/shared/core/ant-scripts/shared.xml
===================================================================
--- /main/trunk/release-kits/shared/core/ant-scripts/shared.xml	(revision 23241)
+++ /main/trunk/release-kits/shared/core/ant-scripts/shared.xml	(revision 23242)
@@ -381,5 +381,6 @@
 		<mkdir dir="components"/>
 	  
-		<pstf dir="compiled" outfile="compiled/uninstall/${component}.uninstall">
+		<!-- the PatternSet To File task takes one or more patternsets and outputs to a file all of the files it includes -->
+		<pstf dir="compiled" outfile="compiled/uninstall/${component}.uninstall" toplevelonly="true">
 			<patternset refid="greenstone${version.major}.${component}.component"/>
 		</pstf>
Index: /main/trunk/release-kits/shared/core/uninstaller/Uninstall.bat
===================================================================
--- /main/trunk/release-kits/shared/core/uninstaller/Uninstall.bat	(revision 23241)
+++ /main/trunk/release-kits/shared/core/uninstaller/Uninstall.bat	(revision 23242)
@@ -51,7 +51,8 @@
 	del Uninstall.*
 	del *.uninstall
-	del ..\bin
-	del ..\tmp
-	del ..\ext
+	rmdir /S /Q ..\bin
+	rmdir /S /Q ..\tmp
+	rmdir /S /Q ..\ext
+	rmdir /S /Q ..\uninstall
 	
 	cd ..
Index: /main/trunk/release-kits/shared/core/uninstaller/Uninstaller.java
===================================================================
--- /main/trunk/release-kits/shared/core/uninstaller/Uninstaller.java	(revision 23241)
+++ /main/trunk/release-kits/shared/core/uninstaller/Uninstaller.java	(revision 23242)
@@ -443,5 +443,5 @@
 		for ( int i=0; i < files.length; i++) {
 			if( files[i].getAbsolutePath().endsWith(".uninstall") ) {
-				String[] paths = getRelevantPathsFromUninstallFile(files[i]);
+				String[] paths = getPathsFromUninstallFile(files[i]);
 				
 				for(int j=0; j < paths.length; j++) {
@@ -481,4 +481,26 @@
 		return (String[]) paths.toArray(new String[0]);
 	}
+	
+	public String[] getPathsFromUninstallFile ( File uninstallFile ) {
+		
+		ArrayList paths = new ArrayList();
+		try {
+			BufferedReader in = new BufferedReader(new FileReader(uninstallFile));
+			
+			String line;
+			while ( (line = in.readLine()) != null ) {
+				if (line.length() > 0 && !paths.contains(line)) {
+					paths.add(line);
+				}
+			}
+			
+			in.close();
+		}
+		catch( Exception ex ) {
+			ex.printStackTrace();
+			return null;
+		}
+		return (String[]) paths.toArray(new String[0]);
+	}
 
 	public void recursiveDelete( File f, File[] exceptions ) throws CancelledException {
