Index: /other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm
===================================================================
--- /other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm	(revision 27700)
+++ /other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm	(revision 27701)
@@ -11,4 +11,5 @@
 use diffutil;
 use Text::Diff;
+use Cwd;
 
 if ($^O =~ m/mswin/i) {
@@ -58,13 +59,15 @@
     my $test_text = readin_gdb($test_cmd);
 
-#	my $savepath = "C:\\Research\\Nightly\\tools\\envi\\etc\\tasks\\diffcol\\"
+#	my $savepath = &getcwd."/../"; # TASK_HOME env does not exist at this stage, but it's one level up from current directory
 #	print_string_to_file($test_text, $savepath.$dbname."_test.out");	
 #	print_string_to_file($model_text, $savepath.$dbname."_model.out");
 
     # filter out the fields that can be ignored in the two database files
-    my $ignore_line_re = "\n<(lastmodified|lastmodifieddate|oailastmodified|oailastmodifieddate)>([^\n])*";
+	# The total_numbytes field can vary depending on how many backslashes exist in the urls in the main body text, as each
+	# of these windows slashes get escaped with another backslash, and the resulting string is used as key into rel link db
+    my $ignore_line_re = "\n<(lastmodified|lastmodifieddate|oailastmodified|oailastmodifieddate|total_numbytes)>([^\n])*";
     $model_text =~ s/$ignore_line_re//g;
     $test_text =~ s/$ignore_line_re//g;
-  
+
 
 	# if the OS doesn't match and one of them is windows, extra work needs to be done to bring the db files
@@ -129,16 +132,11 @@
 		
 		# for the windows text, need to further get rid of the driveletter after [ or <meta>
-		$$win_text =~ s@^(\[|<[^>]*>)[a-zA-Z]:collect@$1collect@mg;	
-		# now can go back to using $model_text and $test_text
-#	print_string_to_file($$win_text, $savepath.$dbname."_test.out");	
-#	print_string_to_file($$lin_text, $$savepath.$dbname."_model.out");
+		$$win_text =~ s@^(\[|<[^>]*>)[a-zA-Z]:collect@$1collect@mg;		
 		
 	} # end of equalising differences between a windows collection's db file and linux coll's db file
 
-	
 	# now can go back to using $model_text and $test_text
-	#print_string_to_file($test_text, "C:\\Research\\Nightly\\tools\\envi\\etc\\tasks\\diffcol\\".$dbname."_test.out");	
-	#print_string_to_file($model_text, "C:\\Research\\Nightly\\tools\\envi\\etc\\tasks\\diffcol\\".$dbname."_model.out");
-		
+#	print_string_to_file($test_text, $savepath.$dbname."_test.out");	
+#	print_string_to_file($model_text, $savepath.$dbname."_model.out");
 	
     my $report_type = "OldStyle"; # Can not change this type.
Index: /other-projects/nightly-tasks/diffcol/trunk/task.pl
===================================================================
--- /other-projects/nightly-tasks/diffcol/trunk/task.pl	(revision 27700)
+++ /other-projects/nightly-tasks/diffcol/trunk/task.pl	(revision 27701)
@@ -37,7 +37,16 @@
 my $use_blat = 0; # if we ever get blat to send mail/attachments on Windows working, set this to 1
 
+
 # TASK_HOME should be the toplevel diffcol folder
 $ENV{'TASK_HOME'} = getcwd unless defined $ENV{'TASK_HOME'};
-$ENV{'TASK_HOME'} =~ s@\/@\\@g if $isWin;
+if($isWin) {
+	$ENV{'TASK_HOME'} =~ s@\/@\\@g;
+	# need to convert TASK_HOME path name to resolve very subtle bug when running task.pl via
+	# run-gs2-diffcol.bat which uses environment.pl's TASK_HOME setting via envi
+	# At that point TASK_HOME is already defined but ends up lowercase, so that entries in archiveinf-doc 
+	# end up sorted differently when db2txt -sort is applied compared to if TASK_HOME had kept its case.	
+	require Win32; # for working out Windows Long Filenames from Win 8.3 short filenames
+	$ENV{'TASK_HOME'} = &Win32::GetLongPathName($ENV{'TASK_HOME'});
+}
 ##    print STDERR "@@@ TASK_HOME: ".$ENV{'TASK_HOME'}."\n";
 
@@ -392,5 +401,5 @@
 	print STDERR "$collection - Importing:\n";
 	print $xml_fh "<import>\n";
-	&run_build_script("import.pl $collection -removeold"); #-OIDtype hash_on_full_filename
+	&run_build_script("import.pl -removeold $collection"); #-OIDtype hash_on_full_filename
 	print $xml_fh "</import>\n";
 	print STDERR "done\n";	
@@ -399,5 +408,5 @@
 	print STDERR "$collection - Building:\n";
 	print $xml_fh "<build>\n";
-	&run_build_script("buildcol.pl $collection -removeold");
+	&run_build_script("buildcol.pl -removeold $collection");
 	print $xml_fh "</build>\n";
 	print STDERR "done\n";
