# Power Automate: Delete a File in SharePoint (Delete File Action)

> For the full documentation index, see https://250highstreet.com/llms.txt

> Use the SharePoint Delete file action to remove a file by its identifier. Learn the two fields, where deleted files go, and how to test safely.

Add the SharePoint action "Delete file". Pick the site address, then pass the file identifier from an earlier step. The flow removes that one file. Test on a copy first.

## What does the Delete file action do?

Microsoft describes it in one line: "Deletes the file specified by the file identifier." It removes a single file from a library. It does not delete a list item. For list items, use the separate "Delete item" action.

## What do you fill in on the Delete file card?

Microsoft lists just two inputs, and the action will not save until both have a value.

1.  Site Address: the site that holds the file, for example https://contoso.sharepoint.com/sites/sitename.
2.  File Identifier: the file to remove. You select it from an earlier step.

## How do you build a delete flow?

1.  Sign in at make.powerautomate.com and start a new cloud flow.
2.  Choose what starts it: a schedule for cleanup jobs, or "When a file is created (properties only)" to react to new files.
3.  If the trigger does not hand you the file, add "Get files (properties only)" and a [Filter array](/guides/power-automate-filter-array/) step first.
4.  Add the SharePoint action "Delete file".
5.  In Site Address, pick the site.
6.  In File Identifier, select the Identifier dynamic content from the earlier step.
7.  Save the flow and run it on one test file.

## Where does a deleted file go?

A file the flow deletes normally lands in the site recycle bin, the same place a person's deletes go. Microsoft says SharePoint keeps deleted items for 93 days from the original delete, first in the site recycle bin and then in the site collection recycle bin.

Look in the site recycle bin before you tell anyone a file is gone. You can restore it from there.

## How do you avoid deleting the wrong file?

A delete flow has no undo step. Use these checks:

1.  Run the flow on one test file in a test library first.
2.  Add a Condition before the delete. Check the file name, folder or age.
3.  Delete one file per run until you trust the filter.
4.  Send yourself an email or a Teams message with the file name before the delete step.

## Can you use Delete file to clean up after a copy?

Yes, but one Move file action is safer than two steps. If the copy works and the delete then fails, the file ends up in both places. The [move file guide](/guides/power-automate-move-file-sharepoint/) covers the single action.

If a delete fails with a lock error, see the guide on [files locked for shared use](/guides/power-automate-file-is-locked-for-shared-use/). To wrap risky steps, use [try and catch scopes](/guides/power-automate-try-catch-scope-error-handling/).

## Want help with a flow that cleans up files?

I am Al Davies at 250 High Street LLC. I set up SharePoint and Power Automate flows for small teams, remotely, including scheduled cleanup jobs with a safety check before anything is deleted. A tracker is \$5,000 and takes 2 weeks. Your first call costs nothing, and past projects are in the [portfolio](/portfolio/).

## FAQ

### Does Delete file also delete list items?

No. Use the separate Delete item action for SharePoint list items.

### Can I delete a file by its name?

The action needs the file identifier. Use Get files (properties only) and a Filter array step to find the file by name, then pass its identifier.

### Can I get a deleted file back?

Usually yes, within 93 days. Open the site recycle bin and restore it. If it is not there, a site collection admin can check the second-stage recycle bin.

## Sources

- [SharePoint connector reference: Delete file (Microsoft Learn)](https://learn.microsoft.com/en-us/connectors/sharepointonline/)
- [Restore items in the recycle bin of a SharePoint site (Microsoft Support)](https://support.microsoft.com/en-us/office/restore-items-in-the-recycle-bin-of-a-sharepoint-site-6df466b6-55f2-4898-8d6e-c0dff851a0be)

## Related guides

- [Power Automate: Move a File in SharePoint (Move File Action)](/guides/power-automate-move-file-sharepoint/)
- [Fix "file is locked for shared use" in Power Automate](/guides/power-automate-file-is-locked-for-shared-use/)
- [Power Automate Try Catch With Scope: Handle Errors in a Flow](/guides/power-automate-try-catch-scope-error-handling/)
- [Power Automate Filter Array: Steps and Examples](/guides/power-automate-filter-array/)

Source: https://250highstreet.com/guides/power-automate-delete-file-sharepoint/
