Skip to content

spo file remove

Removes the specified file

Usage

spo file remove [options]

Options

Option Description
--help output usage information
-w, --webUrl <webUrl> URL of the site where the file to remove is located
-i, --id [id] The ID of the file to remove. Specify either id or url but not both
-u, --url [url] The server- or site-relative URL of the file to remove. Specify either id or url but not both
--recycle Recycle the file instead of actually deleting it
--confirm Don't prompt for confirming removing the file
-o, --output [output] Output type. json|text. Default text
--verbose Runs command with verbose logging
--debug Runs command with debug logging

Examples

Remove the file with ID 0cd891ef-afce-4e55-b836-fce03286cccf located in site https://contoso.sharepoint.com/sites/project-x

spo file remove --webUrl https://contoso.sharepoint.com/sites/project-x --id 0cd891ef-afce-4e55-b836-fce03286cccf

Remove the file with site-relative URL SharedDocuments/Test.docx from located in site https://contoso.sharepoint.com/sites/project-x

spo file remove --webUrl https://contoso.sharepoint.com/sites/project-x --url SharedDocuments/Test.docx

Move the file with server-relative URL /sites/project-x/SharedDocuments/Test.docx located in site https://contoso.sharepoint.com/sites/project-x to the recycle bin

spo file remove --webUrl https://contoso.sharepoint.com/sites/project-x --url /sites/project-x/SharedDocuments/Test.docx --recycle