OfficeDev/PnP — pull request #228 by cbpeters (2014-11-04 15:39:41+00:00)
Title: Added an AddFolder commandlet to create sub folders

I've written a powershell script to bulk upload files to SharePoint but Add-SPOFile doesn't automatically create the folder if it doesn't exist, so I wrote Add-SPOFolder to take care of this.

Here's the PowerShell where I use these two together for reference.

$path = "$dir\Main\Files"
$excludeList = @()
Get-ChildItem -Path $path -Recurse | % {
$pathParts = $_.FullName.substring($pwd.path.Length + 1).split("\");
if ( ! ($excludeList | where { $pathParts -like $_ } ) ) {
$folder = $_.FullName.Replace($path+"\", "").Replace("\"+$_.Name, "").Replace("\", "/")
if ($_.GetType().Name -eq "DirectoryInfo") {
Add-SPOFolder -Name $_.Name -Folder $folder
}
if ($_.GetType().Name -eq "FileInfo") {
Add-SPOFile -Path $_.FullName -Folder $folder
}
}
}