Delete picture from the photo library using the command line?
-
28-05-2021 - |
Frage
After installing my wife's new Mac (macOS 10.15.4 Catalina) some pictures ended up in HEIC format. This format is not convenient for her, so I converted the files using ImageMagick.
Somehow the files where not picked up by the photo application so I imported the converted files back in the library.
Now, I would like to delete the "old" HEIC files. Is it possible to delete them from the command line without corrupting the library?
Lösung
You can either search using the Finder:
kind:heic
Or, from the command-line - mdfind uses Spotlight:
mdfind -name 'heic'
Or, normal unix find:
find /path/to/search/in -iname "*.heic"
You can then use that output to do as you please. Rather than deleting, I agree with Seamus that you could move them first, and confirm no issues with the Photo's library.
eg. to move them:
find /path/to/search/in -iname "*.heic" -exec mv {} /path/to/move/to/ \;