How to manage folders in SharePoint Online?
Effective folder management is crucial for keeping SharePoint Online document libraries and lists organized. This involves key tasks such as creating folders, moving them, and deleting unnecessary or empty folders.
Create a folder in SharePoint Online
- Navigate to the desired SharePoint Online site’s document library or list.
- Click New and select Folder from the drop-down menu.
- Enter a name for the folder and click Create.
Note: Folder creation in SharePoint Online lists is disabled by default. To enable it, go to , select Yes straight to the Folders section, and click OK.
You can also add a folder to a document library or list in SPO by running the following PnP PowerShell cmdlets.
# To connect to the desired SharePoint Online site
Connect-PnPOnline -Url "<SiteUrl>" -ClientId "<ClientID>" –Interactive
# To add a folder to a document library or list
Add-PnPFolder -Name "<FolderName>" -Folder "<FolderPath>"
Move a folder in SharePoint Online
- Select the folders to move, then click the Move to option from the top.
- Select a destination in the current library or another SharePoint site’s document library.
- If the site isn’t listed, choose it using the More places option. Then click Move here to move the folders.
Alternatively, you can use the following PnP PowerShell cmdlets to move the folder within the same site or to a different SharePoint site.
# To move a folder to another document library or folder in the current site
Move-PnPFolder –Folder "<LibraryName>/<FolderName>" -TargetFolder "<DestinationLibrary>/<DestinationFolder>"
# To move a folder to a document library or folder in another site
Move-PnPFile –SourceUrl "<LibraryName>/<FolderName>" -TargetUrl "/sites/<SiteName>/<DestinationLibrary>/<DestinationFolder>"
Delete a folder in SharePoint Online
- Access the document library or list of the desired SharePoint Online site.
- Select the folders and click Delete. You can also right-click or hit ellipses (...) in the folder to find the delete option.
- Then hit the Delete button in the pop-up window.
To delete a folder using PnP PowerShell, run the following cmdlets.
# To move a folder to the site recycle bin
Remove-PnPFolder –Name "<FolderName>" -Folder "<LibraryName>/<ParentFolderName>" –Recycle
# To permanently delete a folder from the SPO site
Remove-PnPFolder –Name "<FolderName>" -Folder "<LibraryName>/<ParentFolderName>"