3

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.

  • You have in effect got you answer to your question. I would suggest you accept one of the answers and pose another question. Include details about unison and Davinci resolve and how you are using them. I would also send an email to both vendors and if possible one of the problem files. – markhunte Jan 19 '15 at 9:57
  • @markhunte no I don't have an answer because clearly some information is missing. Files have different sizes but all other info is the same. Something has to be different. – Poma Jan 19 '15 at 10:10
  • Your question is "How to get file metadata?" which you have two answers. You should either do as I suggested earlier or change this question and the Title. But I would go with a New question. – markhunte Jan 19 '15 at 10:29
  • Also the reason I say this is you are asking two questions in what should be one. – markhunte Jan 19 '15 at 10:31
  • The question is not "How to get some file metadata?". I don't yet have an information about this file that I need. – Poma Jan 19 '15 at 10:37
1

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

  • Tried to run that command. Everything is same except file sizes (updated question). Any clue why this could happen? – Poma Jan 19 '15 at 7:47
  • The difference is probably related to resource forks. These were an integral part of Mac OS prior to OS X, but are uncommon now. Many "backup" utilities do not copy these, and in some cases they are copied as separate hidden files. If you google for "resource forks" you will find some info. Where did the original file come from? – Milliways Jan 19 '15 at 10:13
  • 1
    AFAIK resource forks should appear in ls -l@ as com.apple.ResourceFork attribute. There is no such attribute on my file. File was created by DaVinci Resolve program. All files created by this program are like this. – Poma Jan 19 '15 at 10:33
  • check the two Extended attributes xattr -p com.apple.quarantine and xattr -p Mac_Metadata to the src and copy,what's the different? – nelson Jan 19 '15 at 15:30
0

From a MacIssues article:

  1. Open the Terminal.
  2. Type mdls followed by a single space.
  3. Drag the desired file from the Finder to the Terminal window, or otherwise target the file using Unix file path syntax.
  4. Press Enter to run the command on the file.

I think this is what you are looking for.

  • Tried to run that command. Everything is same except file sizes (updated question). Any clue why this could happen? – Poma Jan 19 '15 at 7:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .