MacOS – How to get file metadata

filesystemhfs+macos

How to get extensive filesystem information about a file?

I have a file that consistently causes errors in my backup utility (Unison). I'm trying to narrow down a bug and find out how it is different from other files. I copied that file and a copy backups fine so bug is not related to file contents. Then I renamed original to make sure a bug is not related to a filename.

So now I have 2 files with exact same contents, same xattrs (I checked) but one of them causes backup to fail. What else could be different between those files?

Also it is not a single case. I have many similar problem files all of which are created by the same program (DaVinci Resolve)

update: I found out that while files show the exact same size in ls -l the problem file has larger size in Finder 'Get Info' dialog. So there is some king of metadata attached to that file. How to view it?

update2: I tried to use mdls and ls -l@ as advised but didn't get an answer. It just shows that file sizes are different but didn't show why. Here is some additional info:

Romans-MacBook-Pro:cut poma$ mdls src.mov 
kMDItemFSContentChangeDate = 2015-01-19 06:12:45 +0000
kMDItemFSCreationDate      = 2015-01-05 04:54:25 +0000
kMDItemFSCreatorCode       = ""
kMDItemFSFinderFlags       = 0
kMDItemFSHasCustomIcon     = 0
kMDItemFSInvisible         = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery      = 0
kMDItemFSLabel             = 0
kMDItemFSName              = "src.mov"
kMDItemFSNodeCount         = 290301124
kMDItemFSOwnerGroupID      = 99
kMDItemFSOwnerUserID       = 99
kMDItemFSSize              = 290301124
kMDItemFSTypeCode          = ""

Romans-MacBook-Pro:cut poma$ mdls copy.mov 
kMDItemFSContentChangeDate = 2015-01-19 06:56:04 +0000
kMDItemFSCreationDate      = 2015-01-19 06:56:04 +0000
kMDItemFSCreatorCode       = ""
kMDItemFSFinderFlags       = 0
kMDItemFSHasCustomIcon     = 0
kMDItemFSInvisible         = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery      = 0
kMDItemFSLabel             = 0
kMDItemFSName              = "copy.mov"
kMDItemFSNodeCount         = 290300838
kMDItemFSOwnerGroupID      = 99
kMDItemFSOwnerUserID       = 99
kMDItemFSSize              = 290300838
kMDItemFSTypeCode          = ""

.

Romans-MacBook-Pro:cut poma$ ls -la@
total 10681888
...
-rw-r--r--@ 1 poma  staff   290300838 Jan 19 13:56 copy.mov
    com.apple.quarantine            22 
    Mac_Metadata            20 
-rw-rw-rw-@ 1 poma  staff   290300838 Jan 19 13:12 src.mov
    com.apple.quarantine            22 
    Mac_Metadata            20 

.

Romans-MacBook-Pro:cut poma$ md5 src.mov 
MD5 (src.mov) = 7d59d01e5efffe3a258eff86d8b775a0
Romans-MacBook-Pro:cut poma$ md5 copy.mov 
MD5 (copy.mov) = 7d59d01e5efffe3a258eff86d8b775a0

As you can see src.mov has different size in ls and mdls while for copy.mov they are the same.

Best Answer

You can list all the metadata attached to a file with the mdls command

See this answer for a sample https://apple.stackexchange.com/a/165098/19086

ls -l@ will show which extended attributes are attached to a file