Search local images quickly using macOS Spotlight or fd.
# Using fd (fastest)
fd -e jpg -e png -e jpeg -e heic -e webp -e gif -e tiff "pattern" /path/to/search
# Using Spotlight
mdfind -onlyin /path/to/search "kMDItemDisplayName == '*pattern*'"
# Today
mdfind -onlyin ~/Pictures "kMDItemContentTypeTree == 'public.image' && kMDItemFSContentChangeDate > $time.today()"
# Last 7 days
mdfind -onlyin ~/Pictures "kMDItemContentTypeTree == 'public.image' && kMDItemFSContentChangeDate > $time.now(-604800)"
# This month
mdfind -onlyin ~/Pictures "kMDItemContentTypeTree == 'public.image' && kMDItemFSContentChangeDate > $time.this_month()"
# Has GPS coordinates
mdfind "kMDItemContentTypeTree == 'public.image' && kMDItemGPSStatus == 'GPS'"
# In specific area (approximate)
mdfind "kMDItemContentTypeTree == 'public.image' && kMDItemGPSLatitude > 39 && kMDItemGPSLatitude < 41"
# All images in home
mdfind "kMDItemContentTypeTree == 'public.image'"
# Specific directory only
mdfind -onlyin ~/Pictures "kMDItemContentTypeTree == 'public.image'"
# Specific types only
mdfind -onlyin ~/Pictures "kMDItemContentType == 'public.png'"
scripts/search_by_name.sh - Search images by filename patternscripts/search_by_date.sh - Search by creation/modification datescripts/list_all.sh - List all images in a directoryscripts/search_by_location.sh - Search by GPS coordinatesscripts/search_by_size.sh - Search by image dimensionsscripts/search_similar.sh - Find visually similar images (requires perceptual hash)scripts/thumbnail.sh - Generate thumbnails for resultsscripts/copy_results.sh - Copy search results to destination| Extension | Type |
|---|---|
| ----------- | ------ |
| jpg/jpeg | JPEG images |
| png | PNG images |
| heic | iPhone photos |
| webp | WebP images |
| gif | GIF images |
| tiff | TIFF images |
| raw | RAW camera files |
| dng | Digital negatives |
| Key | Description |
|---|---|
| ----- | ------------- |
| kMDItemDisplayName | Filename |
| kMDItemFSContentChangeDate | Modification date |
| kMDItemContentCreationDate | Creation date |
| kMDItemPixelWidth | Image width |
| kMDItemPixelHeight | Image height |
| kMDItemGPSLatitude | GPS latitude |
| kMDItemGPSLongitude | GPS longitude |
| kMDItemMake | Camera make |
| kMDItemModel | Camera model |
# Find all screenshots
./scripts/search_by_name.sh "Screen Shot" ~/Desktop
# Find photos from today
./scripts/search_by_date.sh today ~/Pictures
# Find iPhone photos
./scripts/search_by_name.sh "IMG_" ~/Pictures
# Copy results to folder
./scripts/search_by_date.sh today ~/Pictures | ./scripts/copy_results.sh ~/Desktop/today_photos
brew install fdbrew install exiftool共 1 个版本