2

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.

1
  • 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, 2014 at 7:24

3 Answers 3

2

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.

2

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)
1
  • This is a better answer than mine. Use it instead.
    – skarface
    Apr 8, 2016 at 19:19
1

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

You must log in to answer this question.

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