Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

There are many methods that can be used to compare the data of two files. That is not what I'm interested in here.

How can I easily compare or "perform a diff" of what could be called (perhaps you can also help figure out what to call this stuff) the "file-system/OS" properties/attributes of two files?

For example:

-Filename
-Permissions
-Timestamps (created/last modified/last accessed)
-Properties such as "Read Only" or "Hidden" "Executable"
-Any others not listed here that you know of

While I imagine there are different answers for each of them, can such a thing be done (without too much pain) in the following environments:

Windows 7     (assuming NTFS - does this matter?)
Ubuntu Linux  (assuming ext4 - does this matter?)
OSX           (assuming HFS+ - does this matter?)

If an answer contains a response relevant to only one of these environments I will still value it.

share|improve this question
1  
stat (*nix/os x) and dir/attrib/icacls (windows) are most likely what you're after. The details about the files you're looking for are called metadata. –  MaQleod Mar 19 at 7:24

3 Answers 3

up vote 2 down vote accepted

On linux/osx you can do the following

% stat foo > /tmp/foo.stat && stat bar > /tmp/bar.stat && diff /tmp/bar.stat /tmp/foo.stat

Should be pretty easy to wrap the above in a shell script. There are likely ways to do this without using the tmp files.

share|improve this answer

I hope this is what you are looking for.. Its a 3rd party tool...

share|improve this answer

On *nix systems to compare info about foo and bar you can just:

diff <(stat foo) <(stat bar)

you can of course get more info with other commands:

diff <(ls -l foo ; stat foo) <(ls -l bar ; stat bar)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.