Share via

How to Download a Folder from SharePoint Online using PowerShell?

URON 0 Reputation points
2026-03-08T13:12:16.9833333+00:00

Hi Experts,

I have a folder named ABC in the Documents library of SharePoint.

This folder contains many files and subfolders; some contain data (files or folders), while others are empty.

I want to download all the data from this ABC folder while preserving its folder structure.

Please help me with a PowerShell script.

Thank you!

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments

2 answers

Sort by: Most helpful
  1. Tamara-Hu 13,385 Reputation points Microsoft External Staff Moderator
    2026-03-08T14:50:30.1633333+00:00

    Hello @URON

    Thank you for posting your valuable question on Microsoft Q&A forum.   

    According to your description, there may be a potential approach using PowerShell or PnP PowerShell to address your request. 

    PnP PowerShell is considered outside the direct scope of SharePoint, as this tag focuses primarily on built‑in SharePoint functionality. However, I’ve taken the initiative to research this topic and have included some information that may help in the private message. 

    Please refresh this page, and you should see a notification at the top of your thread. Click “View Messages” to access the details I’ve provided. 

    User's image

    I’ll continue to do my best to assist you through this chat channel. 


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Q&A Assist
    2026-03-08T13:12:27.7966667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Downloading an entire folder (including subfolders and empty folders) from SharePoint Online using PowerShell is not documented in the provided context. The context only covers:

    • Downloading files and folders interactively via the SharePoint/OneDrive web UI.
    • Downloading specific Data access governance reports via SharePoint Online PowerShell.

    From the web UI, the documented way to download a folder while preserving structure is:

    1. Go to the SharePoint document library that contains the ABC folder.
    2. Select the ABC folder (not just its contents).
    3. In the top navigation, select Download (or right‑click the folder and select Download).
    4. The browser downloads a .zip file containing all files and subfolders under ABC, preserving the folder structure.
    5. Extract the .zip locally to restore the structure.

    Notes from the documentation:

    • The Download button appears only when items are selected.
    • If multiple files/folders are selected, a single .zip is downloaded with all selected content.
    • Downloads are subject to limits such as total number of files and size.

    A PowerShell script to recursively download a SharePoint Online folder is not covered in the available material.


    References:


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.