How to bulk upload/copy a folder structure and files to SharePoint

So you’ve got a bunch of files nicely arranged in a folder structure sitting on your computer or a network drive that you want to copy up to a SharePoint library and preserve the directory structure. On the surface this is a daunting task as you can’t just give SharePoint your folder structure and tell it to do the work for you, so what are your options.

Option 1: Manually via SharePoint IU

Recreate the folder structure in SharePoint and upload the files via SharePoint UI in batches doing a multiple file upload to one destination folder at a time. Not much fun for anyone, but it can be done.

Option 2: Commercial Tool

Try a 3rd party tool. Yes they will probably cost you but will get the job done and probably with a few extra bell’s and whistles like applying metadata to SharePoint columns during the process. Some of the key companies to take a look at would be:

Option 3: Open Source Tools

There are some open source projects going around that claim to handle these types of bulk uploads, here’s a couple that look interesting:

http://spbulkdocumentimport.codeplex.com/

http://spfileupload.codeplex.com/

Option 4: Script it Yourself

PowerShell is an awesome way to get things done quickly in SharePoint, I’ve written these scripts in the past that show you how to create folders and how to upload documents to SharePoint. With a bit of extension and effort you could roll your own scripted solution.

https://camerondwyer.wordpress.com/2013/05/27/how-to-import-upload-an-entire-folder-of-files-to-sharepoint-using-powershell/

https://camerondwyer.wordpress.com/2013/11/06/sharepoint-powershell-how-to-create-sharepoint-library-folders-for-loadperformance-testing/

Option 5: Explorer View

The old ‘Open Library in Explorer View’ option in SharePoint may get you out of trouble if the directory structure and number of files is fairly small. Simply use the Explorer View to open the SharePoint library up in a Windows Explorer window and then copy/paste or drag/drop into the Window and the magic will start to happen

Option 6: OneDrive for Business

Now this is my preferred option for getting the job done, and the reason for writing this blog post! To achieve this one, browse to your library in SharePoint and click on the sync button to have the SharePoint library sync’d via OneDrive to your local machine.

bulk-upload-folder-structure-sharepoint-cameron-dwyer-onedrive-sync-button

After the sync has completed the SharePoint library (and it’s content including any folder structure) is now represented as a folder structure that you can easily get to through Windows Explorer.

bulk-upload-folder-structure-sharepoint-cameron-dwyer-onedrive-local-library

Now it’s just a matter of copy/paste or drag/drop your local folder structure (that you want to copy to SharePoint) into this folder in Windows Explorer. Here is my folder structure I want to copy up to SharePoint.

bulk-upload-folder-structure-sharepoint-cameron-dwyer-folders-to-upload

So I can just copy the “My Folder Structure” folder and paste it into the SharePoint sync library location. This is super quick because it’s just copying between 2 locations on your local hard drive.

bulk-upload-folder-structure-sharepoint-cameron-dwyer-onedrive-sync

Now the real goodness happens. OneDrive will sync the entire folder structure including any content files up to SharePoint in the background. You will notice that the folders and files you have just pasted have a tiny icon in the left corner. This will display a green tick when the item has been created in SharePoint. This is awesome, your computer is still free to use, there’s no lockup. If you need to shutdown before the sync is finished, it will just pick up from where it left off. OneDrive’s mission in life is to keep your local folder in sync with the SharePoint library, and it will work tirelessly in the background to do this.

Another powerful advantage this method has over many of the other options I provided earlier is that it will work with Office 365 which you just can’t reach some of those other methods.

Now my disclaimer before I get people throwing virtual rotten fruit at me. I’m not suggesting you use this method to move an entire network drive to SharePoint. Yes, I advocate you should take the opportunity to clean up the data on your network drives and not just move the problem to SharePoint. I also believe in the use of metadata to classify content rather than using folders. Having said that, there are valid instances when you do need to perform an upload of many files and preserve the folder structure in SharePoint and I think the OneDrive approach is a pretty cool tool to add to your arsenal.

41 thoughts on “How to bulk upload/copy a folder structure and files to SharePoint

Add yours

    1. Thanks Benjamin, I’ve updated the post to include Sharegate and have heard good things about your products (although I haven’t had the opportunity to use them personally).

      Like

    1. Hi Darrell,

      Can you elaborate more on the question? Are you trying to bulk upload multiple versions of the same document and end up with one ‘latest’ document in SharePoint with other documents as SharePoint ‘previous versions’ of the document? Thanks.

      Like

      1. In a Documents Library you can turn on Versioning, which preserves a version of a document each time you edit and save the document. With “minor version” selected, documents will be listed as 1.1, 1.2, 1.3 etc. You can easily revert to an earlier version by clicking on the version number of interest. So it is one document but with a record of previous versions. Will that be preserved when uploaded via OneDrive?

        Like

      2. Hi Darrell,

        Thanks for clarifying the question.

        If you sync a SharePoint document library (with minor versioning enabled as you have described) then this is the behavior you get:
        – Only the latest version of the file is stored in the local sync’d folder on your machine.
        – When you open, edit, save the file (from your local location) then when a sync happens in the background you changes will go in as a new version.

        Example:
        I have a SharePoint library with just one Word document in it and it is at version 0.1
        I sync the library using OneDrive
        I open the file from my local sync’d folder
        I make a change to the file and save in Word
        I now go back to SharePoint and take a look at the version history and it’s at 0.2

        I hope this answers your question.

        Like

    1. Hi Vince. I don’t think your local file permissions will sync to SharePoint. Once items have synced to SharePoint you can right click on the folder (local folder that has been synced) and you get a OneDrive | Share… option which really just opens the relevant webpage in SharePoint to allow sharing of the item. SharePoint security cascades down the folder structure, so a solution for you might be to manually create the top level folder in SharePoint and assign correct permissions, then use OneDrive to upload all descendant folder structure.

      Like

    1. Sure, I took a look at your website and looks like a useful tool. I haven’t had a chance to try it out but I’m happy to add it to list of commercial tools. Thanks for bringing it to my attention!

      Like

  1. I know nothing about SharePoint and have nothing fascinating to add. But THANK YOU. You just saved me hours! I just wanted to copy folders with nothing in them and could not find this anywhere on Microsoft help.

    Like

  2. I just found out that your preferred solution doesnt work with PictureLibraries, they cannot be synced. You have a better solution?

    Like

  3. I’m attempting to use OneDrive for Business to connect to a new SharePoint Library exactly as you explain and I’m frustrated as it prompts for Credentials and I enter them, but then the screen sits at the Office credentials sign in and does nothing, no errors .. nothing after I click Sign In. if I then click on X to close that screen, OneDrive for Business Error “We can’t connect to the specified SharePoint site” Note: it’s the company admin and Owner of site attempting to sync. I must be missing a step or a Library settings. Note: Windows 10 Laptop

    Like

  4. Hello, I’ve attempted to setup the Sync via OneDrive for Business to a new SharePoint library as you describe above, all appears normal except I’m asked to sign in to account to access the library, I go ahead and enter proper account credentials, but then it sits there and does nothing, no errors or prompts. If I hit X to close the office sign in windows (looks exactly the same as the local copy of Office Activation prompt), I get the OneDrive for Business Error “We can’t connect to the specified SharePoint site…. The account is that of the Office 365 admin and the Site Owner/creator and full rights to the Document library. I feel I’m missing something, but not sure what. Any ideas would be appreciated Thank you.

    Like

    1. Hi Cathy. I often struggle with Microsoft Authentication and find it gets itself it knots now and again. For me it’s not usually OneDrive Sync, rather it’s other applications. I usually find clearing out my browser caches and any stored windows credentials helps. As for OneDrive specific help you could try looking at the following articles if you haven’t already:
      https://support.office.com/en-us/article/Fix-OneDrive-for-Business-sync-problems-e12c6a8b-4bbe-4391-9c23-1a52b55a1967?ui=en-US&rs=en-US&ad=US
      https://support.office.com/en-us/article/Fix-OneDrive-sync-problems-with-Windows-10-Windows-8-Windows-7-or-Windows-Vista-83AB0D8A-8400-45B0-8DCF-DC8AA8A6BCF8?ui=en-US&rs=en-US&ad=US
      http://www.windowscentral.com/9-tips-help-you-fix-onedrive-sync-problems-windows-10

      Good luck!

      Like

      1. I got it working and boy was I confused about OneDrive and OneDrive for Business App(s) and there purpose, even as a Techy person lol. We haven’t really touched this feature at all until now and it was my understanding that “OneDrive” was for Personal accounts ( I have one of those and use it all the time) and “OneDrive for Business” was for business and enterprise accounts that have SharePoint feature as a Sync tool, plus the OneDrive are for each User. I was very wrong there, as I search and learned about these two Apps (both showing on Win 10 OS) I wasn’t sure if I need to disable the OneDrive or not, then read a blogs from MS and in those too, I wasn’t always 100% which App they were referring too, but a few times I saw mentions of seeing connections to both personal and/or business in the Windows Explore and saw same screens I see are the OneDrive App for signing in for OneDrive for Business. for the heck of it, I decided to try signing into to “OneDrive” with business account and well, it worked and now i see both a OneDrive -Personal and OneDrive- SharePoint site name, and then now your instruction above work. Perhaps I’m just the dumb one here or overthinking it perhaps.. but I really thought those two Apps were not interconnected to each other. Lots to Learn here I see. Hope this might help someone else who may have thought the same. Thank you for your input.

        Liked by 1 person

  5. Hi Cameron. Love your work. Often read your articles and am very impressed. But this time…Umm No mention of the 5,000 file limit – come on!!! No mention that the documents will be checked out if mandatory metadata is not completed??? And i’m really surprised that you didn’t sneak in a mention of the brilliant ‘Send to SharePoint’ on the context menu of OnePlace.

    As a SP consultant, I come across so many companies who just push their entire network file structure up to SP. I think you should make clear the MS limitations and restrictions https://support.microsoft.com/en-us/kb/2933738

    Mike

    Liked by 1 person

    1. Hi Mike, thanks for adding the link to the technical limitations that exists with OneDrive sync, this is very valuable info for anyone looking at the OneDrive sync option. Despite it’s problems the OneDrive sync is still probably one of the best out-of-the-box methods for a user to bulk upload a folder structure to SharePoint. You’re not going to beat a 3rd party product that is designed to do this and give a rich experience around validation and applying metadata on the way up though, so if your requirement can’t be satisfied with the free OneDrive option then unfortunately it’s time for a 3rd party product, or some custom dev/scripts 🙂 Thanks for the OnePlace ‘Send to SharePoint’ plug!

      Like

  6. I just released a free tool which is doing exactly what you are looking for:
    https://fiechter.eu/onedrivebackup/

    – It removes all the characters not working with SharePoint 2013 / 2016 / Online and OneDrive for Business
    – It verifies the supported file extensions
    – It ensures that the modified / creation date remain
    – It uses the BITS / large file API for Office 365

    Liked by 1 person

  7. Quick question, I have created folder structures using python and then used the explorer view to upload files. I want to distribute files to pupils. Each pupil has a named folder with a specific set of sub directories. At the moment I have to recreate the whole folder structure including the new files and then repeat the process (as we are only adding new files there is little risk of damaging existing documents) Would any of the tools that you have seen be able to upload files to specifically named sub folders eg every pupils computing ot English folder?

    Like

    1. Hi Rick. I’m not aware of any tools that will do this out of the box. To me it seems like you could split your problem into 2 and try to tackle them individually.

      Part 1 – Local sync of SharePoint library
      I’m assuming that all student directories are within the one SharePoint library. If that’s the case you could use OneDrive to sync that library to your PC. That then gives you a local folder structure that will stay in sync with what is SharePoint. I.e. if you add any files to the student folders they will sync up to SharePoint. So that’s part 1 (and you can do that pretty easily, depending on size and number of files the initial sync may take a while).

      Part 2 – Scripted method for adding new files to student folders
      This is where you would need to do some work. Essentially you would need to script the copying of files you want to deploy into the student folders, but now you don’t have to worry about SharePoint, you just have to worry about the directory structure on your local PC. This thread may give you some ideas of how you could achieve this: https://social.technet.microsoft.com/Forums/ie/en-US/28aa968c-a67a-440e-a1da-449829d2610a/copy-file-into-multiple-folders?forum=ITCG

      Like

  8. Hoo boy. I think I have opened up a hornet’s nest. Perhaps I was too quick on leaping and not long enough on looking first!
    I wanted to easily move Word documents from an old Windows 7 to only one folder in Sharepoint. I synced. ALL of mine and my colleagues’ folders from the beginning of time on Sharepoint uploaded to my computer! How do I un-sync!???
    Or is there a fix?

    Like

    1. That doesn’t sound great! Try this for a fix.

      Right click the OneDrive for Business icon in the Windows System Tray:
      Go to Settings | Account (tab)
      You should see a list of SharePoint libraries that you are syncing
      From here you can Choose Folder from the SharePoint library that you want to sync

      I’m not sure if this will automatically clean up all the folders and files you’ve already synced. You may have to delete them from your PC manually BUT ENSURE you’ve stopped the sync of the folders you don’t want first and I’d leave it a while before manually deleting. And even then I’d just try deleting 1 file and wait a few hours to ensure it really has stopped syncing (your worst case scenario is that if it’s still syncing then deleting from your PC will also delete it from SharePoint). If you do find that this happens, you can use the Recycle bin in SharePoint to restore your files.

      Good luck.

      Like

  9. This doesn’t work for me – it won’t let me right the folder that is created locally. I tried unticking read only but it still gives an error.

    Like

  10. I came across your website after searching all day on the internet for solution and I like your work here. I have recently started a new job in a company and been entrusted to work with Sharepoint which I have never use before.
    I am required to duplicate about 100+ files in sharepoint library on the same directory in sharepoint. The copied files will need to preserve metadata as the original copy and different file name to distinguish it from the original copy. The content of the copied file will be updated later when its available. At the moment I can only manually copy on Sharpoint one by one – click file to be copied (Temp_module1) select Copy  enter destination site (http://sharepoint/library user/) enter destination file name (V001_Temp_module1)

    Is there any method or script or batch file that I can use to run to do this job faster?

    Really appreciate any help.

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑