I am using the Create-FtpDirectory
function Create-FtpDirectory { param( [Parameter(Mandatory=$true)] [string] $sourceuri, [Parameter(Mandatory=$true)] [string] $username, [Parameter(Mandatory=$true)] [string] $password ) if ($sourceUri -match '\\$|\\\w+$') { throw 'sourceuri should end with a file name' } $ftprequest = [System.Net.FtpWebRequest]::Create($sourceuri); $ftprequest.Method = [System.Net.WebRequestMethods+Ftp]::MakeDirectory $ftprequest.UseBinary = $true $ftprequest.Credentials = New-Object System.Net.NetworkCredential($username,$password) $response = $ftprequest.GetResponse(); Write-Host Upload File Complete, status $response.StatusDescription $response.Close(); }
Taken from Ftp.psm1 , where you can also find other functions for FTP.
To others: itβs a pity that they did not follow the well-known template of the noun verb .;)
source share