Last active
November 3, 2025 19:03
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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