title: Move files between document libraries in the same Site Collection
body: <p>I have a need to move ~10,000 files from one document library to another in the same site collection. I believe that powershell is the best means for doing this.</p>
  
  <p>I found the following article: <a href="http://blog.isaacblum.com/2011/10/04/spfilecollection-class-copy-files-to-another-document-library/#respond" rel="nofollow">http://blog.isaacblum.com/2011/10/04/spfilecollection-class-copy-files-to-another-document-library/#respond</a> that suggested a means for doing this however I'm unsure how to adapt this script (I'm getting my first exposure to Powershell with this project).</p>
  
  <p>I tried the following to no avail:</p>
  
  <pre><code>$PSSnapin = Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
  clear
  
  $org = "hhttp://farm/sitecollection/Document Library Source/Forms/AllItems.aspx"
  $dest = "hhttp://farm/sitecollection/Document Library Destination/Forms/AllItems.aspx"
  
  $orgLibrary = (Get-SPWeb $org).Folders["Documents"]
  $destLibrary = (Get-SPWeb $dest).Folders["Documents"]
  $destFiles = $destLibrary.Files
  foreach ($file in $orgLibrary.Files)
  {
      $curFile = $file.OpenBinary()
      $destURL = $destFiles.Folder.Url + "/" + $file.Name
      $destFiles.Add($destURL, $curFile, $true)
  }
  </code></pre>
  
  <p>Is there an alternate way of doing this? Note that I'm using MOSS2007 and Powershell 2.0, not SharePoint 2010.</p>
  
  <p><strong>Update / Semi-Answer:</strong></p>
  
  <p>As per x0n's post below this isn't supported in SharePoint 2007 (only 2010). I recevied the following advice outside of this thread, which is pertinent, and should help others in future:</p>
  
  <blockquote>
    <p>Unfortunately SharePoint 2010's Management Shell (it's PowerShell
    snap-in and associated cmdlets) is not compatible with MOSS 2007 and
    there aren't cmdlets available directly from Microsoft for that
    version of SharePoint. What that means is that you can still use
    PowerShell with MOSS 2007, but you're either going to have to write
    your own cmdlets that use STSADM or the SharePoint Object Model
    directly, or you're going to have to use MOSS 2007-compatible cmdlets
    from a third party. I'd suggest checking out Gary Lapointe's blog for
    a lot of great PowerShell cmdlets for MOSS 2007
    (http://blog.falchionconsulting.com/), or places where people upload
    cmdlets such as CodePlex.com, the TechNet Script Repository,
    POSHCode.org, or <a href="http://get-spscripts.com/" rel="nofollow">http://get-spscripts.com/</a>.</p>
  </blockquote>