Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8237945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:38:38+00:00 2026-06-07T19:38:38+00:00

I have a need to move ~10,000 files from one document library to another

  • 0

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.

I found the following article: http://blog.isaacblum.com/2011/10/04/spfilecollection-class-copy-files-to-another-document-library/#respond 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).

I tried the following to no avail:

$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)
}

Is there an alternate way of doing this? Note that I’m using MOSS2007 and Powershell 2.0, not SharePoint 2010.

Update / Semi-Answer:

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:

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 http://get-spscripts.com/.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:38:39+00:00Added an answer on June 7, 2026 at 7:38 pm

    I’m not surprised you’re getting nowhere: The Microsoft.SharePoint.PowerShell snapin is for SharePoint 2010 only, and isn’t available on a SharePoint 2007 server.

    Frankly, the easiest way to do this is to open Internet Explorer, navigate to the source document library and open the “explorer view.” Select all documents, and copy (ctrl+c). Open another IE window and do the same thing for the target document library and paste (ctrl+v).

    If it won’t open in explorer view, ensure that the machine you’re using to do the copy/paste has the “WebClient” service running. If you’re running Windows 2008 R2, this service is not available unless you decide to add the “desktop experience” feature. It’s a lot easier to find a Windows 7 machine instead, which will have the WebClient service (but be sure it’s running.)

    Update:

    That said, your script is probably about 80% there and doesn’t really need that 2010 snapin. I can’t test this right now (sorry) but it should be about 99% correct:

    [reflection.assembly]::loadwithpartialname("microsoft.sharepoint") > $null
    
    $org = "http://farm/sitecollection/sourcedoclib" 
    $dest = "http://farm/sitecollection/targetdoclib" 
    
    $site = new-object microsoft.sharepoint.spsite $org
    $web = $site.openweb()
    
    $srcLibrary = $web.Lists["sourcedoclib"] 
    $destLibrary = $web.Lists["targetdoclib"] 
    
    $destFiles = $destLibrary.Folders["Archived"]
    
    foreach ($item in $srcLibrary.Items) 
    { 
       if ($item.File) {
            $curFile = $item.file.OpenBinary() 
            $destURL = $destFiles.Folder.Url + "/" + $item.file.Name 
            $destFiles.Add($destURL, $curFile, $true)
        }
    } 
    

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a situation where I need to move files from one location to
I need to move views from one content control to another, I have no
I have some content from a CMS that I need to move to raw
I have a directory with 1.3 Million files that I need to move into
I need to know how to move a image from one location to another
I have a task where I need to move a bunch of files from
I have a need to move an item in an IEnumerable<> up, that is
I have groups of people. I need to move groups with at least one
I need to move the data from Oracle to Sybase. I have successfully moved
I have two tables with the same column definitions. I need to move (not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.