Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tk_mac

macrumors member
Original poster
Dec 26, 2019
82
8
I have used file directory compare tools such as Visual Differ and Beyond Compare. I see issues where these tools often don’t detect certain things such as a Finder label or tag differing on a folder in the two sides of the comparison, or an empty folder appearing on only one side. I am looking for suggestions on alternative tools that will show me these differences. I want to see the differences in a tree and not just sync without looking. Thanks
 
I mean, there's the diff command. if you send its output to a text file it might get you what you need. It's an incredibly powerful tool and I would think that it might do what you need. I don't know for sure though. It likely doesn't have support for Finder attributes, but it probably will tell you if a folder is only one one side of the comparison no matter the state of said folder. :)
 
I mean, there's the diff command. if you send its output to a text file it might get you what you need. It's an incredibly powerful tool and I would think that it might do what you need. I don't know for sure though. It likely doesn't have support for Finder attributes, but it probably will tell you if a folder is only one one side of the comparison no matter the state of said folder. :)
I am able to detect if a folder is on one side. I need specifically to detect differences in the Finder tags on both folders and files.
 
Finder tags reside in metadata, specifically, extended attributes (xattr's).

The 'xattr' command is usable from a Terminal window, or a scripted shell command, such as in a Run Shell Script action in Automator.

You can read a summary of xattr's builtin help by pasting this into a Terminal window:
xattr -h

The man page can be read with: man xattr

The 'ls' command is capable of listing all the xattr's on a file or dir. It uses the -l@ options. It has more options, such as the one for a recursive listing.

I suspect you'd need to capture the output in a file (redirect stdout), do that for both directories of interest, then diff them.

One possible obstacle to this is that xattr can only output the contents of the xattr's in hex, so deciphering that in a sensible way could be formidable.

EDIT
I just remembered that the 'rsync' command can copy xattr's, which suggests it can also identify files that have different xattrs. The -n option tells rsync to do a dry run. You'll probably need to read its man page to figure out the full set of options that tell it to do the right kind of dry run, with xattr's, comparing files & dirs.
 
Last edited:
  • Like
Reactions: organicCPU
i got a 30 day free trial for Path Finder. it worked well for my needs but cant say it does the comparison thing.

i was using it to:
Finder was refusing to delete files off my old NAS box. I used Path Finder to help delete these stubborn locked files
 
I think there is currently no perfect tool to make folder comparison on metadata level. Depending on what exactly you need to achieve and what you´re comparing, there may be solutions that could get the job done.

One Example that bases on @chown33 idea to get a list of files that differ from one directory to another, but without any information, what is the difference:
Bash:
rsync -aniXA --out-format="%i_%f" --exclude='.DS_Store' /path/to/Folder1/ /path/to/Folder1/Folder2 | sed 's/[^_]*_/\//'
And yes, if you´re working a lot with Tags, you should know about xattr command, but also worth a notice are mdls and mdfind that could be used like this:
Bash:
# To get a list of Tags
mdls -name kMDItemUserTags /path/to/FolderOrFile
# or to get the files that do have a Tag
mdfind 'kMDItemUserTags=*' -onlyin /path/to/Folder
# or to get the files that do have the Tag green
mdfind 'kMDItemUserTags=green' -onlyin /path/to/Folder
kMDItemUserTags are not the only existing Tags and it depends on your use case to make use of the above commands with pipes or other string manipulation.
Finally, I can strongly recommend James Berry´s command line tool tag. Hope that helps a bit.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.