You are missing
$
:
$transferResult = $session.PutFiles($localPath, $remotePath, false, $transferOptions)
$
:
$transferResult = $session.PutFiles($localPath, $remotePath, false, $transferOptions)
transferOptions.FileMask = "|*/";
$transferResult = $session.PutFiles($localPath, $remotePath, false, transferOptions)