Hi,
You can try to create a PowerShell script to check the file size and restore a previous version if the file size is 0 bytes. Here's a basic example:
$filePath = "C:\Users\YourUsername\OneDrive\YourImageFile.jpg"
$fileSize = (Get-Item $filePath).length
if ($fileSize -eq 0) {
# Restore previous version using OneDrive's version history
# This part will require OneDrive API or a third-party tool to automate
Write-Output "File size is 0 bytes. Restoring previous version..."
# Add your code to restore the previous version here
} else {
Write-Output "File size is not 0 bytes. No action needed."
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.