# Define the folder path $folderPath = $PSScriptRoot # Get all HEIC files in the folder $heicFiles = Get-ChildItem -Path $folderPath -Filter *.HEIC # Counter for deleted files $deletedCount = 0 # Loop through each HEIC file foreach ($heicFile in $heicFiles) { # Create the corresponding MOV file path $movFilePath = [System.IO.Path]::ChangeExtension($heicFile.FullName, "MOV") # Check if the MOV file exists if (Test-Path $movFilePath) { # Delete the MOV file Remove-Item $movFilePath -Force Write-Host "Deleted: $movFilePath" # Increment the counter $deletedCount++ } } # Display the number of deleted files Write-Host "Total MOV files deleted: $deletedCount"