FTP/Split-PathToFTPScript.ps1

function Split-PathToFTPScript {
    Param(
        # path to split into multiple "cd <directory>" lines
        [Parameter(Mandatory=$true)]
        [string]
        $Path
    )

    $Directories = $Path.Split('\')
    foreach ($Directory in $Directories) {
        $FtpScript += "cd `"$Directory`"{0}" -f [System.Environment]::NewLine
    }

    $FtpScript
}

Export-ModuleMember -Function Split-PathToFTPScript