SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 4 down vote accepted

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)


share|improve this answer
That's exactly what I needed, thanks! – Joren Maurissen Apr 30 '13 at 14:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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