Index: ./lib/e2k-path.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/e2k-path.c,v
retrieving revision 1.4
diff -u -p -r1.4 e2k-path.c
--- ./lib/e2k-path.c	13 Dec 2005 03:54:28 -0000	1.4
+++ ./lib/e2k-path.c	19 Jul 2006 08:20:40 -0000
@@ -206,6 +206,51 @@ e_path_find_folders (const char *prefix,
 }
 
 
+/** This function removes the xml file "connector-matadata.xml, which is present in a directory */
+
+static void
+remove_connector_metadata (char *physical_path)
+{
+	char *entire_path ;
+
+	 entire_path = g_strdup_printf ("%s/%s", physical_path , "connector-metadata.xml");
+	if ( g_file_test (entire_path, G_FILE_TEST_EXISTS) )
+		g_remove(entire_path);
+	g_free(entire_path);
+	return;
+}
+
+/**
+This is a function to recursively traverse through every subfolder and start deleting it from the innermost subfolder
+*/
+
+static void
+recursive_remove_directories (char *physical_path)
+{
+	GError *error = NULL;
+	GDir *dir;
+	char *path1;
+	char *entire_path;
+
+	if (g_rmdir (physical_path) == -1) {
+		if ( (dir = g_dir_open (physical_path, 0, &error)) != NULL ){
+			remove_connector_metadata (physical_path);
+		}
+		if (g_rmdir(physical_path) == 0 ){
+			g_dir_close(dir);
+			return;
+		}
+		while  ( (path1 = g_dir_read_name(dir)) != NULL){
+			entire_path = g_strdup_printf ("%s/%s", physical_path,path1);
+			recursive_remove_directories (entire_path);
+		}
+		g_free(entire_path);
+		g_rmdir (physical_path);
+		g_dir_close (dir);
+	}
+	return ;
+}
+
 /**
  * e_path_rmdir:
  * @prefix: a prefix to prepend to the path, or %NULL
@@ -223,31 +268,34 @@ int
 e_path_rmdir (const char *prefix, const char *vpath)
 {
 	char *physical_path, *p;
-
+	
 	/* Remove the directory itself */
 	physical_path = e_path_to_physical (prefix, vpath);
 	if (g_rmdir (physical_path) == -1) {
+		recursive_remove_directories(physical_path);
 		g_free (physical_path);
-		return -1;
+		return 0;
 	}
+	return 0 ; 
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
-	/* Attempt to remove its parent "subfolders" directory,
-	 * ignoring errors since it might not be empty.
-	 */
 
-	p = strrchr (physical_path, '/');
-	if (p[1] == '\0') {
-		g_free (physical_path);
-		return 0;
-	}
-	*p = '\0';
-	p = strrchr (physical_path, '/');
-	if (!p || strcmp (p + 1, SUBFOLDER_DIR_NAME) != 0) {
-		g_free (physical_path);
-		return 0;
-	}
 
-	g_rmdir (physical_path);
-	g_free (physical_path);
-	return 0;
-}
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/ChangeLog,v
retrieving revision 1.72
diff -u -p -r1.72 ChangeLog
--- ChangeLog	11 May 2006 09:39:41 -0000	1.72
+++ ChangeLog	19 Jul 2006 08:37:27 -0000
@@ -1,3 +1,10 @@
+2006-06-19  Vandana Shenoy .b  <shvandana@novell.com>
+
+	Fixes #339267
+	*  exchange/lib/e2k-path.c 
+	(recursive_remove_directories) : Removes a directory by recursively traversing all its sub directories
+	(remove_connector_metadata)
+
 2006-05-11  Chenthill Palanisamy  <pchenthill@novell.com>
 
 	Fixes #334626
