I'm using SharePoint Foundation 2010.

I have to make a PowerShell script that copies a structure found on a network share. Its all good except for one thing... I know how to make Document Library's and folders inside them, I also know how to upload files to the document library's BUT I can't find out how to upload a file to a folder inside a document library.

For clarification:
Document library
-Folder -->Upload to this folder

1 Answer 1


To create a Document library:

New-SPList -Web http://spwebaddress -ListTitle “Enter Title Here” -ListUrl “ListURL” -Description “Description” -Template “Document Library”

To upload to a folder within document library you should get the spfolder then add to it...

$folder.Files.Add($folder.Url + “/” + $file.Name, [System.IO.Stream]$fileStream, $true)




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.