none
How to upload multiple files form local directory via PowerShell to SharePoint Online? RRS feed

  • Question

  • I have a lot of files in a local folder (> 5.000) which need to be uploaded to SharePoint Online through PowerShell.

    How can i loop through all files within a local folder, authenticate myself againt SharePoint Online and upload the files to a document library through PowerShell?


    Best regards BOG

    Thursday, February 9, 2017 5:44 PM

All replies

  • Please check this is Wiki Article

    https://social.technet.microsoft.com/wiki/contents/articles/34603.o365-sharepoint-online-upload-your-files-remotely-using-powershell-and-csom.aspx

    Thanks

    Kislay

    If this has solved your query please mark this post as Answer

    Thursday, February 9, 2017 6:49 PM
  • Hi

    I agree with Kislay's answer but

    That example if it 's ok if you need to upload from the root folder to the root library

    If you need to copy all files in all subfolder you need to use

    #Upload file
      
    Foreach ($File in (dir $Folder -File -Recurse))
    {
    
    the rest of the coode
    }

    Let me know if you need to upload keeping the subfollders structure in the destination


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.



    Thursday, February 9, 2017 6:56 PM
  • Hi

    another way

    Map the SP Online library locally, and next copy as usual! from drive to drive in command prompt or directly drag and drop


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Thursday, February 9, 2017 9:26 PM
  • Here is the link 

    https://gallery.technet.microsoft.com/PowerShell-Bulk-Upload-b9e9d600


    Please remember to click Mark as Answer on the answer if it helps you

    Thursday, February 9, 2017 10:20 PM