Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to compare 2 folders using Automator on 10.8.2 o.s.?

I need to compare the contents of two folders, in order to know the items that are not the same in those folders.


I have tried to use Automator, but seems to be complex... bye the way... is there any site to lear how to use it?


Many thanks for your time. 😉

MacBook Pro (15-inch Early 2011), Mac OS X (10.7.5)

Posted on Nov 30, 2012 7:37 PM

Reply
2 replies

May 19, 2016 10:34 AM in response to Anaklasis

Here is a folder action that does not depend on third-party actions for directory comparisons. Tested with Python 2.7.10 on OS X 10.11.5.


Files in Folder A:

  • hbo.html
  • test.pages


Files in Folder B:

  • date.pages
  • hbo.html


The first action, Ask for Finder items assumes that you are going to select the first folder, and then press the command key, and select the second folder.


These folders will then be passed onto the do shell script action as arguments, and pulled off the command line in order right into dirpath1 and dirpath2 variables in Python. The standard Python filecmp module uses its dircmp to recursively compare each directory (and sub-directory if it exists) contents. Finally the report_full_closure() method writes out the results that are passed on to the new text file action.


For the above two folders, the report in the text file is as follows. The None indicates it found no sub-folders. Save the workflow below as a Automator Application.


diff /Users/viking/Desktop/A /Users/viking/Desktop/B

Only in /Users/viking/Desktop/A : ['test.pages']

Only in /Users/viking/Desktop/B : ['date.pages']

Identical files : ['hbo.html']

None


User uploaded file

How to compare 2 folders using Automator on 10.8.2 o.s.?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.