Skip to content

Instantly share code, notes, and snippets.

@atao
Last active November 3, 2025 19:03
Show Gist options
  • Select an option

  • Save atao/8f2fb0a2440f140dfedb8e4a91f06015 to your computer and use it in GitHub Desktop.

Select an option

Save atao/8f2fb0a2440f140dfedb8e4a91f06015 to your computer and use it in GitHub Desktop.
The purpose of this script is to delete the .MOV files associated with live photos when importing images from an iPhone to Windows using the Photos app. Specifically, it targets .MOV files that have matching .HEIC files, ensuring only the .HEIC files remain in the folder after the script is executed.
# 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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment