Skip to content

spo folder move

Moves a folder to another location

Usage

spo folder move [options]

Options

Option Description
--help output usage information
-u, --webUrl <webUrl> The URL of the site where the folder is located
-s, --sourceUrl <sourceUrl> Site-relative URL of the folder to move
-t, --targetUrl <targetUrl> Server-relative URL where to move the folder
--allowSchemaMismatch Ignores any missing fields in the target destination and moves the folder anyway
-o, --output [output] Output type. json|text. Default text
--verbose Runs command with verbose logging
--debug Runs command with debug logging

Important

Before using this command, log in to a SharePoint Online site, using the spo login command.

Remarks

To move a folder, you have to first log in to a SharePoint Online site using the spo login command, eg. spo login https://contoso.sharepoint.com.

When you move a folder using the spo folder move command, all of the document versions are moved.

Examples

Move folder to a document library in another site collection

spo folder move --webUrl https://contoso.sharepoint.com/sites/test1 --sourceUrl /Shared%20Documents/MyFolder --targetUrl /sites/test2/Shared%20Documents/

Move folder to a document library in the same site collection

spo folder move --webUrl https://contoso.sharepoint.com/sites/test1 --sourceUrl /Shared%20Documents/MyFolder --targetUrl /sites/test1/HRDocuments/

Move folder to a document library in another site collection. Allow for schema mismatch

spo file move --webUrl https://contoso.sharepoint.com/sites/test1 --sourceUrl /Shared%20Documents/sp1.pdf --targetUrl /sites/test2/Shared%20Documents/ --allowSchemaMismatch

More information