Index: /main/trunk/greenstone2/bin/script/gsConvert.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/gsConvert.pl	(revision 27508)
+++ /main/trunk/greenstone2/bin/script/gsConvert.pl	(revision 27509)
@@ -53,4 +53,5 @@
 use parsargv;
 use util;
+use FileUtils;
 use Cwd;
 
@@ -149,5 +150,5 @@
     my ($tailname,$dirname,$suffix) 
 	= File::Basename::fileparse($input_filename, "\\.[^\\.]+\$");
-    my $output_filestem = &util::filename_cat($dirname, "$tailname");
+    my $output_filestem = &FileUtils::filenameConcatenate($dirname, "$tailname");
 
     if ($input_type eq "")
@@ -383,5 +384,5 @@
 	    $ppt_convert_type = "-p";
 	}
-	my $vbScript = &util::filename_cat($ENV{'GSDLHOME'}, "bin",
+	my $vbScript = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "bin",
 					   $ENV{'GSDLOS'}, "pptextract");
 	$vbScript = "pptextract" if ($ENV{'GSDLOS'} =~ m/^windows$/i);
@@ -539,5 +540,5 @@
 
 	# build up the path to the doc-to-html conversion tool we're going to use
-	my $vbScript = &util::filename_cat($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'});
+	my $vbScript = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'});
 
     if ($ENV{'GSDLOS'} =~ m/^windows$/i) {
@@ -547,5 +548,5 @@
 		if($input_filename =~ m/docx$/i) {	# need to use full path to docx2html script, 
 											# else script launch fails when there are error msgs
-			$vbScript = &util::filename_cat($vbScript, "docx2html.vbs"); 
+			$vbScript = &FileUtils::filenameConcatenate($vbScript, "docx2html.vbs"); 
 			$vbScript = "CScript //Nologo \"$vbScript\"";	# launche with CScript for error output in STDERR
 									# //Nologo flag avoids Microsoft's opening/logo msgs
@@ -555,9 +556,9 @@
 		else {	# old doc versions. use the usual VB executable word2html for the
 				# conversion. Doesn't need full path, since bin\windows is on PATH			
-			$vbScript = "word2html"; #$vbScript = "\"".&util::filename_cat($vbScript, "word2html")."\"";
+			$vbScript = "word2html"; #$vbScript = "\"".&FileUtils::filenameConcatenate($vbScript, "word2html")."\"";
 		}
     } 
 	else { # not windows
-		$vbScript = "\"".&util::filename_cat($vbScript, "word2html")."\"";
+		$vbScript = "\"".&FileUtils::filenameConcatenate($vbScript, "word2html")."\"";
 	}
 
@@ -616,5 +617,5 @@
 	close(TMP);
 	if ($line && $line =~ m/html/i) {
-	    &util::rm("$output_filestem.err") if -e "$output_filestem.err";
+	    &FileUtils::removeFiles("$output_filestem.err") if -e "$output_filestem.err";
 	    return 1;
 	}
@@ -622,5 +623,5 @@
 	
     # If here, an error of some sort occurred
-    &util::rm("$output_filestem.html") if -e "$output_filestem.html";
+    &FileUtils::removeFiles("$output_filestem.html") if -e "$output_filestem.html";
     if (-e "$output_filestem.err") {
 	if ($faillogfile ne "" && defined(open(FAILLOG,">>$faillogfile"))) {
@@ -630,5 +631,5 @@
 	    close ERRLOG;
 	}
-	&util::rm("$output_filestem.err");
+	&FileUtils::removeFiles("$output_filestem.err");
     }
     return 0;
@@ -684,9 +685,9 @@
 
     if ($was_successful) {
-	&util::rm("$output_filestem.err")
+	&FileUtils::removeFiles("$output_filestem.err")
 	    if (-e "$output_filestem.err");
 	# insert the (modified) table of contents, if it exists.
 	if (-e "${output_filestem}_ToC.html") {
-	    &util::mv("$output_filestem.html","$output_filestem.src");
+	    &FileUtils::moveFiles("$output_filestem.html","$output_filestem.src");
 	    my $open_failed=0;
 	    open HTMLSRC, "$output_filestem.src" || ++$open_failed;
@@ -698,5 +699,5 @@
 		close TOC;
 		close HTML;
-		&util::mv("$output_filestem.src","$output_filestem.html");
+		&FileUtils::moveFiles("$output_filestem.src","$output_filestem.html");
 		return 1;
 	    }
@@ -726,6 +727,6 @@
 	    close HTML;
 
-	    &util::rm("${output_filestem}_ToC.html");
-	    &util::rm("${output_filestem}.src");
+	    &FileUtils::removeFiles("${output_filestem}_ToC.html");
+	    &FileUtils::removeFiles("${output_filestem}.src");
 	}
 	# we don't yet do anything with footnotes ($output_filestem_fn.html) :(
@@ -744,8 +745,8 @@
 	    close FAILLOG;
 	}
-	&util::rm("$output_filestem.err");
-    }
-
-    &util::rm("$output_filestem.html") if (-e "$output_filestem.html");
+	&FileUtils::removeFiles("$output_filestem.err");
+    }
+
+    &FileUtils::removeFiles("$output_filestem.html") if (-e "$output_filestem.html");
 
     return 0;
@@ -787,5 +788,5 @@
     if ($retval!=0 || ! -s "$output_filestem.html")
     {
-	&util::rm("$output_filestem.out") if (-e "$output_filestem.out");
+	&FileUtils::removeFiles("$output_filestem.out") if (-e "$output_filestem.out");
 	# print out the converter's std err, if any
 	if (-s "$output_filestem.err") {
@@ -798,5 +799,5 @@
 	}
 	#print STDERR "***********output filestem $output_filestem.html\n";
-	&util::rm("$output_filestem.html") if (-e "$output_filestem.html");
+	&FileUtils::removeFiles("$output_filestem.html") if (-e "$output_filestem.html");
 	if (-e "$output_filestem.err") {
 	    if ($faillogfile ne "" && defined(open(FAILLOG,">>$faillogfile")))
@@ -807,11 +808,11 @@
 		close FAILLOG;
 	    }	
-	    &util::rm("$output_filestem.err");
+	    &FileUtils::removeFiles("$output_filestem.err");
 	}
 	return 0;
     }
 
-    &util::rm("$output_filestem.err") if (-e "$output_filestem.err");
-    &util::rm("$output_filestem.out") if (-e "$output_filestem.out");
+    &FileUtils::removeFiles("$output_filestem.err") if (-e "$output_filestem.err");
+    &FileUtils::removeFiles("$output_filestem.out") if (-e "$output_filestem.out");
     return 1;
 }
@@ -873,5 +874,5 @@
     if ($retval !=0) 
     {
-	&util::rm("$output_filestem.out") if (-e "$output_filestem.out");
+	&FileUtils::removeFiles("$output_filestem.out") if (-e "$output_filestem.out");
 	#print out the converter's std err, if any
 	if (-s "$output_filestem.err") {
@@ -883,5 +884,5 @@
 	    close ERRLOG;
 	}
-	#&util::rm("$output_filestem.html") if (-e "$output_filestem.html");
+	#&FileUtils::removeFiles("$output_filestem.html") if (-e "$output_filestem.html");
 	if (-e "$output_filestem.err") {
 	    if ($faillogfile ne "" && defined(open(FAILLOG,">>$faillogfile")))
@@ -892,10 +893,10 @@
 		close FAILLOG;
 	   }	
-	    &util::rm("$output_filestem.err");
+	    &FileUtils::removeFiles("$output_filestem.err");
 	}
 	return 0;
     }
-    &util::rm("$output_filestem.err") if (-e "$output_filestem.err");
-    &util::rm("$output_filestem.out") if (-e "$output_filestem.out");
+    &FileUtils::removeFiles("$output_filestem.err") if (-e "$output_filestem.err");
+    &FileUtils::removeFiles("$output_filestem.out") if (-e "$output_filestem.out");
     return 1;
 }
@@ -917,5 +918,5 @@
     {
 	print STDERR "Error executing $cmd: $!\n";
-	&util::rm("$output_filestem.text") if (-e "$output_filestem.text");
+	&FileUtils::removeFiles("$output_filestem.text") if (-e "$output_filestem.text");
     }
 
@@ -932,5 +933,5 @@
 	if ($seen_text==0) { # no text was extracted
 	    print STDERR "Error: pdftotext found no text\n";
-	    &util::rm("$output_filestem.text");
+	    &FileUtils::removeFiles("$output_filestem.text");
 	}
     }
@@ -949,6 +950,6 @@
 	}
 	# does this converter create a .out file?
-	&util::rm("$output_filestem.out") if (-e "$output_filestem.out");
-	&util::rm("$output_filestem.text") if (-e "$output_filestem.text");
+	&FileUtils::removeFiles("$output_filestem.out") if (-e "$output_filestem.out");
+	&FileUtils::removeFiles("$output_filestem.text") if (-e "$output_filestem.text");
 	if (-e "$output_filestem.err") {
 	    if ($faillogfile ne "" && defined(open(FAILLOG,">>$faillogfile")))
@@ -959,9 +960,9 @@
 		close FAILLOG;
 	    }
-	    &util::rm("$output_filestem.err");
+	    &FileUtils::removeFiles("$output_filestem.err");
 	}
 	return 0;
     }
-    &util::rm("$output_filestem.err") if (-e "$output_filestem.err");
+    &FileUtils::removeFiles("$output_filestem.err") if (-e "$output_filestem.err");
     return 1;
 }
@@ -1013,5 +1014,5 @@
     {
 	print STDERR "Warning: Error executing gs: $error\n";
-	&util::rm("$output_filestem.text") if (-e "$output_filestem.text");
+	&FileUtils::removeFiles("$output_filestem.text") if (-e "$output_filestem.text");
 
 	if ("$faillogfile" ne "" && defined(open (FAILLOG, ">>$faillogfile")))
@@ -1025,5 +1026,5 @@
 	    close FAILLOG;
 	}
-	&util::rm("$output_filestem.err") if (-e "$output_filestem.err");
+	&FileUtils::removeFiles("$output_filestem.err") if (-e "$output_filestem.err");
 
 
@@ -1112,5 +1113,5 @@
     # wrap the text - use a minimum length. ie, first space after this length.
     my $wrap_length=72;
-    &util::mv("$output_filestem.text", "$output_filestem.text.tmp");
+    &FileUtils::moveFiles("$output_filestem.text", "$output_filestem.text.tmp");
     open INFILE, "$output_filestem.text.tmp" ||
 	die "Couldn't open file: $!";
@@ -1131,7 +1132,7 @@
     close INFILE;
     close OUTFILE;
-    &util::rm("$output_filestem.text.tmp");
-
-    &util::rm("$output_filestem.err") if (-e "$output_filestem.err");
+    &FileUtils::removeFiles("$output_filestem.text.tmp");
+
+    &FileUtils::removeFiles("$output_filestem.err") if (-e "$output_filestem.err");
     return 1;
 }
@@ -1171,5 +1172,5 @@
     close TEXT;
 
-    &util::rm("$output_filestem.text") if (-e "$output_filestem.text");
+    &FileUtils::removeFiles("$output_filestem.text") if (-e "$output_filestem.text");
     return 1;
 }
@@ -1224,5 +1225,5 @@
     }
 
-    &util::rm("$output_filestem.text");
+    &FileUtils::removeFiles("$output_filestem.text");
     return 0;
 
Index: /main/trunk/greenstone2/perllib/plugins/BaseMediaConverter.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/BaseMediaConverter.pm	(revision 27508)
+++ /main/trunk/greenstone2/perllib/plugins/BaseMediaConverter.pm	(revision 27509)
@@ -117,5 +117,5 @@
     }
 
-    my $base_output_dir = &util::filename_cat($collect_dir,"cached",$dirname);
+    my $base_output_dir = &FileUtils::filenameConcatenate($collect_dir,"cached",$dirname);
 
     if (!-e $base_output_dir ) {
@@ -123,8 +123,8 @@
 	    if ($verbosity>2);
 
-	&util::mk_all_dir($base_output_dir);
-    }
-
-    my $output_dir = &util::filename_cat($base_output_dir,$file_root);
+	&FileUtils::makeAllDirectories($base_output_dir);
+    }
+
+    my $output_dir = &FileUtils::filenameConcatenate($base_output_dir,$file_root);
 
     if (!-e $output_dir) {
@@ -132,5 +132,5 @@
 	    if ($verbosity>2);
 
-	&util::mk_dir($output_dir);
+	&FileUtils::makeAllDirectories($output_dir);
     }
 
Index: /main/trunk/greenstone2/perllib/plugins/ConvertBinaryFile.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/ConvertBinaryFile.pm	(revision 27508)
+++ /main/trunk/greenstone2/perllib/plugins/ConvertBinaryFile.pm	(revision 27509)
@@ -45,4 +45,5 @@
 no strict 'subs';
 use util;
+use FileUtils;
 
 
@@ -108,10 +109,10 @@
 	my $colplugname = undef;
 	if (defined $ENV{'GSDLCOLLECTDIR'}) {
-	    $colplugname = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},
+	    $colplugname = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'},
 					       "perllib","plugins", 
 					       $plugin_package);
 	}
 
-	my $mainplugname = &util::filename_cat($ENV{'GSDLHOME'},
+	my $mainplugname = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},
 					       "perllib","plugins", 
 					       $plugin_package);
@@ -255,5 +256,5 @@
 
     my $lc_suffix = lc($suffix);
-    my $tmp_filename = &util::filename_cat($tmp_dirname, "$utf8_tailname$lc_suffix");
+    my $tmp_filename = &FileUtils::filenameConcatenate($tmp_dirname, "$utf8_tailname$lc_suffix");
     
     # If gsdl is remote, we're given relative path to input file, of the form import/tailname.suffix
@@ -261,5 +262,5 @@
     # the input_filename is the absolute path, see http://perldoc.perl.org/File/Spec.html
     my $ensure_path_absolute = 1; # true
-    &util::soft_link($input_filename, $tmp_filename, $ensure_path_absolute);
+    &FileUtils::softLink($input_filename, $tmp_filename, $ensure_path_absolute);
     my $verbosity = $self->{'verbosity'};
     if ($verbosity > 0) {
@@ -267,5 +268,5 @@
     }
 
-    my $errlog = &util::filename_cat($tmp_dirname, "err.log");
+    my $errlog = &FileUtils::filenameConcatenate($tmp_dirname, "err.log");
     
     # Execute the conversion command and get the type of the result,
@@ -290,5 +291,5 @@
 	
     # remove symbolic link to original file
-    &util::rm($tmp_filename);
+    &FileUtils::removeFiles($tmp_filename);
     
     # Check STDERR here
@@ -307,5 +308,5 @@
 	    close ERRLOG;
 	}
-	&util::rm("$errlog") if (-e "$errlog");
+	&FileUtils::removeFiles("$errlog") if (-e "$errlog");
 	return "";
     }
@@ -364,5 +365,5 @@
 	}
 	else {
-	    &util::mv("${conv_filename}.tmp", $conv_filename);
+	    &FileUtils::moveFiles("${conv_filename}.tmp", $conv_filename);
 	}	
     }
@@ -460,5 +461,5 @@
     # associate original file with doc object
     my $cursection = $doc_obj->get_top_section();
-    my $filename = &util::filename_cat($base_dir, $file);
+    my $filename = &FileUtils::filenameConcatenate($base_dir, $file);
     my $assocfilename = "doc.$doc_ext";
     if ($self->{'keep_original_filename'} == 1) {
@@ -489,5 +490,5 @@
      if (defined $tmp_dir && -d $tmp_dir) {
 	 ##print STDERR "**** Suppressing clean up of tmp dir\n";
-	 &util::rm_r($tmp_dir);
+	 &FileUtils::removeFilesRecursive($tmp_dir);
 	 $self->{'tmp_dir'} = undef;
      }
Index: /main/trunk/greenstone2/perllib/plugins/PagedImagePlugin.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/PagedImagePlugin.pm	(revision 27508)
+++ /main/trunk/greenstone2/perllib/plugins/PagedImagePlugin.pm	(revision 27509)
@@ -425,5 +425,5 @@
     close BACKUP;
     &File::Copy::copy ($backup_filename, $filename);
-    &util::rm($backup_filename);
+    &FileUtils::removeFiles($backup_filename);
 
 }
@@ -643,8 +643,8 @@
 
 	if ($line =~ /imgfile=\"([^\"]+)\"/) {
-	    &util::block_filename($block_hash,&util::filename_cat($dir,$1));
+	    &util::block_filename($block_hash,&FileUtils::filenameConcatenate($dir,$1));
 	}
 	if ($line =~ /txtfile=\"([^\"]+)\"/) {
-	    &util::block_filename($block_hash,&util::filename_cat($dir,$1));
+	    &util::block_filename($block_hash,&FileUtils::filenameConcatenate($dir,$1));
 	}
     }
@@ -672,9 +672,9 @@
 	# find the image file if there is one
 	if (defined $imgname && $imgname ne "") {
-	    &util::block_filename($block_hash, &util::filename_cat( $dir,$imgname));
+	    &util::block_filename($block_hash, &FileUtils::filenameConcatenate( $dir,$imgname));
 	}
 	# find the text file if there is one
 	if (defined $txtname && $txtname ne "") {
-	    &util::block_filename($block_hash, &util::filename_cat($dir,$txtname));
+	    &util::block_filename($block_hash, &FileUtils::filenameConcatenate($dir,$txtname));
 	}
     }
Index: /main/trunk/greenstone2/perllib/util.pm
===================================================================
--- /main/trunk/greenstone2/perllib/util.pm	(revision 27508)
+++ /main/trunk/greenstone2/perllib/util.pm	(revision 27509)
@@ -27,4 +27,5 @@
 
 use strict;
+use FileUtils;
 
 use Encode;
@@ -238,5 +239,5 @@
 
     $tmp_dirname = &FileUtils::filenameConcatenate($tmp_dirname, "tmp");
-    &util::mk_dir($tmp_dirname) if (!-e $tmp_dirname);
+    &FileUtils::makeDirectory($tmp_dirname) if (!-e $tmp_dirname);
 
     # add the timestamp into the path otherwise we can run into problems 
@@ -250,5 +251,5 @@
 	$i++;
     }
-    &util::mk_dir($tmp_dirname);
+    &FileUtils::makeDirectory($tmp_dirname);
  
     return $tmp_dirname;
