0

I am using sp 2010. I have a document library with sub folders. I would like to remove the folders. Before I remove them I need to move the documents to the root of the library. Is this possible in SP GUI or in powershell?

4 Answers 4

0

As you are using the SP 2010, In your case I think, You can use the Content and Structure options and move the required files.

You can access this page > Site Actions|Manage Content and Structure or Site settings > Site administration > Content and Structure.

Check these blogs to more details: http://www.thesharepoint.com/SitePages/Content%20and%20Structure.aspx

http://sharepointadam.com/2012/06/27/move-a-site-within-a-site-collection-using-content-and-structure/

0

Yes you can, using the SPFile.MoveTo function, like this example :

string siteUrl = "http://sharepoint-devsite.com/DevSite";
string fileName = "ProjectPlan.docx";
string sourceDirectory = "/DevSite/Shared Documents";
string destinationDirectory  = "/DevSite/ProjectDocs/ProjTeam/DevTeam/TechLead";
using (SPSite currSite = new SPSite(siteUrl))
{
    using (SPWeb currWeb = currSite.OpenWeb())
    {
        MoveFile(currWeb, destinationDirectory, sourceDirectory, fileName);
    }
}

public void MoveFile(SPWeb sourceWeb, string sourceDirectory, string destinationDirectory, string fileName)
{
    SPFile sourcefile = sourceWeb.GetFile(sourceDirectory + "/" + fileName);
    if (sourcefile.Exists)
    {
        object modifiedOn = sourcefile.Item["Modified"];
        object modifiedBy = sourcefile.Item["Modified By"];

        //true - replace if file exists
        sourcefile.MoveTo(destinationDirectory + "/" + fileName, true);   

        ...

Reference : http://adicodes.com/move-files-of-sharepoint-document-library-using-object-model/

1
  • Does this answers your question?
    – KhalilG
    Commented Mar 14, 2015 at 16:26
0

Using GUI, you can open Explorer View and make simple drag and drop.

enter image description here

0

A suggestion: Open the document library in explorer. Try running a search for specific file extensions, and cut/copy the results into the parent document library (a second explorer tab). Try doing this in batches - particularly if the library contains large files.

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.