Ok, so I guessed wrong. Its not case sensitive i had the GetFileAtrrb wrong.

Here is the problem line:

code:

if ( $Result = 16 ) ; directory already exists


Correct code should be:
code:

if ($Result & 16) = 16 ; directory already exists

Regards,

Adam A