Am einfachsten ist es wahrscheinlich, den mdls
Befehl zu verwenden. mdls
listet die Metadatenattribute für eine angegebene Datei auf. Hier ist ein Beispiel für eine PNG-Datei, die ich auf meinem Desktop habe
$ mdls ~/Desktop/hipchat.png _kMDItemOwnerUserID = 205009058 _kTimeMachineIsCreationMarker = 1 _kTimeMachineNewestSnapshot = 4001-01-01 00:00:00 +0000 _kTimeMachineOldestSnapshot = 2016-06-10 19:25:01 +0000 kMDItemBitsPerSample = 32 kMDItemColorSpace = "RGB" kMDItemContentCreationDate = 2016-06-10 19:37:53 +0000 kMDItemContentModificationDate = 2016-06-10 19:37:53 +0000 kMDItemContentType = "public.png" kMDItemContentTypeTree = ( "public.png", "public.image", "public.data", "public.item", "public.content" ) kMDItemDateAdded = 2016-06-10 19:45:06 +0000 kMDItemDisplayName = "hipchat.png" kMDItemFSContentChangeDate = 2016-06-10 19:37:53 +0000 kMDItemFSCreationDate = 2016-06-10 19:37:53 +0000 kMDItemFSCreatorCode = "" kMDItemFSFinderFlags = 0 kMDItemFSHasCustomIcon = (null) kMDItemFSInvisible = 0 kMDItemFSIsExtensionHidden = 0 kMDItemFSIsStationery = (null) kMDItemFSLabel = 0 kMDItemFSName = "hipchat.png" kMDItemFSNodeCount = (null) kMDItemFSOwnerGroupID = 80 kMDItemFSOwnerUserID = 205009058 kMDItemFSSize = 22994 kMDItemFSTypeCode = "" kMDItemHasAlphaChannel = 0 kMDItemKind = "Portable Network Graphics image" kMDItemLogicalSize = 22994 kMDItemOrientation = 0 kMDItemPhysicalSize = 24576 kMDItemPixelCount = 74520 kMDItemPixelHeight = 81 kMDItemPixelWidth = 920 kMDItemResolutionHeightDPI = 0 kMDItemResolutionWidthDPI = 0
Sie können dann die gesuchten Informationen wie gewünscht extrahieren.
$ mdls ~/Desktop/hipchat.png |grep -e kMDItemContentCreationDate |awk '' Created on 2016-06-10 at 19:37:53 $ mdls ~/Desktop/hipchat\ poll.png |grep -e kMDItemContentModificationDate |awk '' Modified on 2016-06-10 at 19:37:53