If you accidentally delete a file or folder in OneDrive, you may be able to recover it later from the OneDrive recycle bin.
Task: Restoring deleted files or folders from your Recycle Bin.
Instructions:
Step 1 - Go to the OneDrive website, and sign in.
Step 2 - In the navigation pane, select Recycle bin.

Step 3 - Select the files or folders you want to restore by pointing to each item and clicking the circle check box that appears, and then click Restore.
Tip: If you're using OneDrive with your personal account, you can select Restore all items to restore everything in your recycle bin. This option isn't available in your work or school OneDrive. Files deleted from your Personal Vault will only show up in your recycling bin if your Personal Vault is unlocked before you check the recycle bin. You can use the Show Personal Vault items command in the recycle bin to unlock the Personal Vault and see those items.

Note: If you're signed in with a work or school account, items in the recycle bin are automatically deleted after 93 days, unless the administrator has changed the setting.
Outcome: The file or folder is restored to its original folder.
Task: To restore deleted files or folders from your Recycle Bin in Windows.
If you deleted the files or folders from your OneDrive desktop App, check your Recycle Bin (Windows) or Trash (Mac) to see if your files are there.
Note: Deleted online-only files do not appear in your computer's Recycle Bin or Trash.
Instructions:
Step 1 - Open the Recycle Bin.
Step 2 - Select the files or folders you want to recover.
Step 3 - Right-click the file or folder and select Restore.

Outcome: The file or folder is restored to its original folder.
Task: To restore deleted files or folders from your Trash on a MAC.
If you deleted the files or folders from your OneDrive desktop App, check your Recycle Bin (Windows) or Trash (Mac) to see if your files are there.
Note: Deleted online-only files do not appear in your computer's Recycle Bin or Trash.
Instructions:
Step 1 - Open the Trash.
Step 2 - Select the files or folders you want to recover.
Step 3 - Right-click on the file or folder and select Put back.

Outcome: The file or folder is restored to its original folder.
Task: To restore recent files in M365 Office Online.
If you try to move or copy files, or accidentally updated a file you didn't mean to, you can restore recent files in M365 Office Online.
Instructions:
Step 1 - Go to OneDrive online - https://portal.office.com > choose OneDrive.
Step 2 - Click on Settings - gear icon in the upper right.
Step 3 - Choose Restore your OneDrive.
Step 4 -Under Select a Date choose Custom date and time
Step 5 - Scroll down - you will see a list of all the changed files and folders in reverse chronological date. When you check the mark next to a file, all the files above it will also be selected and all the checked files will be restored. There is no option to select individual files - it is all the files since the oldest selected that will be restored.
Step 6 - After selecting the files you want restored, click Restore near the top of the page.
Outcome: An acknowledgement page appears while it restores files, then you can return to your OneDrive.
Further reading: