Skip to main content

spo folder remove

Deletes the specified folder


m365 spo folder remove [options]


-u, --webUrl <webUrl>

The URL of the site where the folder to be deleted is located.

--url <url>

The server- or site-relative decoded URL of the folder to delete.


Recycles the folder instead of actually deleting it.

-f, --force

Don't prompt for confirming deleting the folder.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is options.

--query [query]

JMESPath query string. See for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.


Runs command with verbose logging.


Runs command with debug logging.


The spo folder remove command will remove folder only if it is empty. If the folder contains any files, deleting the folder will fail.


Remove a folder with a specific site-relative URL.

m365 spo folder remove --webUrl --url '/Shared Documents/My Folder'

Remove a folder with a specific server relative URL to the site recycle bin.

m365 spo folder remove --webUrl --url '/sites/project-x/Shared Documents/My Folder' --recycle


The command won't return a response on success.