Is there a similar functionality of "Get Info" (Cmd+I) from the Mac OS X Terminal.app?
I would like to ask if in OS X there is a similar functionality of "Get Info" (Cmd+I) but from the Mac OS X Terminal.app? I mean something like finderGetInfo /path/to/a/file.ext which will output the infos for the file but in the terminal console? Like this:
But from the command line:
Machine:~ antony$ finderGetInfo /Users/antony/file.ext
General:
Kind: Document
Size: 29 bytes (4 KB on disk)
Where: /Users/antony
Created: Today 08:58
Modified: Today 08:58
Stationery pad: NO
Locked: NO
More Info:
--
Name & Extension: file.ext
Comments: ...
etc...
It would be very useful when creating some automatic tools that need to extrapolate some useful information from a file of any type.
Is it possible in OS X?
mdls
lists file metadata. A sample below for a folder
kMDItemContentCreationDate = 2011-11-20 04:05:42 +0000
kMDItemContentModificationDate = 2014-10-22 01:52:53 +0000
kMDItemContentType = "public.folder"
kMDItemContentTypeTree = (
"public.folder",
"public.directory",
"public.item"
)
kMDItemDateAdded = 2014-10-17 09:19:38 +0000
kMDItemDisplayName = "temp"
kMDItemFSContentChangeDate = 2014-10-22 01:52:53 +0000
kMDItemFSCreationDate = 2011-11-20 04:05:42 +0000
kMDItemFSCreatorCode = ""
kMDItemFSFinderFlags = 0
kMDItemFSHasCustomIcon = (null)
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery = (null)
kMDItemFSLabel = 0
kMDItemFSName = "temp"
kMDItemFSNodeCount = 96
kMDItemFSOwnerGroupID = 80
kMDItemFSOwnerUserID = 501
kMDItemFSSize = (null)
kMDItemFSTypeCode = ""
kMDItemKind = "Folder"
kMDItemLastUsedDate = 2014-12-03 03:57:48 +0000
kMDItemUseCount = 2
kMDItemUsedDates = (
"2014-10-25 13:00:00 +0000",
"2014-12-02 13:00:00 +0000"
)