# Reloading Files Problem Please Help

**URL:** https://forum.highend3d.com/t/reloading-files-problem-please-help/2308
**Category:** Maya
**Tags:** mel
**Created:** [April 5, 2007, 7:28pm UTC](https://forum.highend3d.com/t/reloading-files-problem-please-help/2308 "2007-04-05T19:28:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![fccool](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/f/bbe5ce/32.png) [@fccool](https://forum.highend3d.com/u/fccool)
#### Post date: [April 5, 2007, 7:28pm UTC](https://forum.highend3d.com/t/reloading-files-problem-please-help/2308/1 "2007-04-05T19:28:58Z")

</div>

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;

	}
```

}

}

---

<div class="post-metadata">

### Author: ![davvey](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/d/90ced4/32.png) [@davvey](https://forum.highend3d.com/u/davvey)
#### Post date: [April 5, 2007, 8:05pm UTC](https://forum.highend3d.com/t/reloading-files-problem-please-help/2308/2 "2007-04-05T20:05:33Z")

</div>

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"

---

<div class="post-metadata">

### Author: ![fccool](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/f/bbe5ce/32.png) [@fccool](https://forum.highend3d.com/u/fccool)
#### Post date: [April 5, 2007, 8:38pm UTC](https://forum.highend3d.com/t/reloading-files-problem-please-help/2308/3 "2007-04-05T20:38:01Z")

</div>

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.
