0

I am wondering if there is a way to get Automator to compare two directories and sort the results in macOS Big Sur?

I have two large directories sitting up in a local network. I want to compare the contents of the two and find any folders/files that aren't in one or other and/or are different versions.

I had planned to just do it through command line using diff -rq. But, I was wondering if there is a way to run it through Automator and have it at least display the differences (but ideally sort for me!)?

user3439894
  • 58,676
  • RE: "(but ideally sort for me!)" -- Then you should edit your question and define what that statement means to you! How do you want the output sorted? That said, IMO, Terminal is the way to go, however you can use a Run Shell Script action or even a Run AppleScript action in an Automator workflow to execute diff -rq. I'd use Terminal and redirect the output to a file and then use the various command line utilities available to process the output, i.e. awk, perl, grep, sed, etc. It depends out how you want to output sorted. – user3439894 Oct 22 '21 at 22:45
  • Have a look at the following answer for additional information with using diff and also read the manual page of diff. https://apple.stackexchange.com/questions/10252/what-directory-comparison-tools-can-i-use-on-os-x/228548#228548 -- You can read the manual page for command in Terminal by typing man command, then press enter, or for easier reading, just type command and then right-click on it and select: Open man Page – user3439894 Oct 22 '21 at 22:50
  • There are various apps that do this including FileMerge which is part of Xcode which is free. – mmmmmm Oct 23 '21 at 10:38
  • Thanks for the info! I'm new to the terminal world, so these were helpful. I ended up where I wanted with the combo of diff, sort, and sed. – smallMonkey Oct 29 '21 at 17:52

0 Answers0