Reloading Files Problem Please Help

Here's a scipt that I came up with to iterate through referenced files and replace these with a new locations. When I run the script it does what it supposed to but then spits out.....

// Error: File not found.: //tails-server/tails render/Treetop_Studios/Tails_Video_1/Characters/Goose/Susie/scenes/Susie2.mb //

When I copy and paste the above path to the command :file -loadReference Susie2RN -type "mayaBinary" -options "v=0" "//tails-server/tails render/Treetop_Studios/Tails_Video_1/Characters/Goose/Susie/scenes/Susie2.mb";

it runs fine...

What am I doing wrong? The script is shown below. Any help is appreciated.

$foundFiles = (ls -typ "reference");
print $foundFiles;

for ($elem in $foundFiles) {

if (!`gmatch $elem "*sharedReferenceNode*"` && !`gmatch $elem "*UNKNOWN\_REF\_NODE*"`) {

	if (`gmatch $elem "*Sky*"`) {
		file -removeReference "T:/Treetop\_Studios/Tails\_Video\_1/Props/Scene\_2/UpThereSky/Sky.mb";
	}

	else {	
		string $origLocation = (`referenceQuery -f $elem`);

		file -removeReference $origLocation;


string	$newLocation = `substitute "T:/" $origLocation "//tails-server/tails render/"` ;		
		file -loadReference $elem -type "mayaBinary" -options "v=0" $newLocation;

	}

}

}

Hi

Not sure but the problem maybe with the path as I have found mel scripts don't like file paths with spaces in them. Try same but don't use any folders with spaces in them
eg. "tails_render" not "tails render"

Nevermind! I am an idiot I have

file -removeReference $origLocation;

But still it should have told me that the REF NODE does not exist instead of telling me that the file path is incorrect

Oh well. By removing the line the script works pretty well if you need it.