Hi I've been trying to find utilities that will do this but I am guessing applescript/Automator on Catalina mac would work too.

Basically I have 2 folders with all kinds of books (.pdf, .mobi and .epub) and subfolders too. I want to only copy files of extension epub type in these 2 folders, into a 3rd folder.

So by running the script the third folder would have only unique EPUB files from the former two folders.

Can anyone please advise me how to write this up in Automator? Thanks!


If you want to run this in Terminal you can use

find /path/to/top/of/source -type f -iname '*.epub' -exec cp '{}' /path/to/target/ \;

This will duplicate all files, which might be heavy on disk space depending on the number and size of your Epubs. You can also just link them by using

find /path/to/top/of/source -type f -iname '*.epub' -exec ln '{}' /path/to/target/ \;
| improve this answer | |
  • Thanks the first cmd will traverse thru subfolders too? – sd100 Dec 3 '19 at 9:53
  • @sd100 find always does by default. You can run find /path/to/top/of/source -type f -iname '*.epub' -print first to see which files it finds. – nohillside Dec 3 '19 at 9:55
  • Yes the find command worked great! Thanks! – sd100 Dec 5 '19 at 0:49

There are actually many different ways to do it in Automator! Here is one set of actions you could use:

  • Ask For Finder Items
  • Get Folder Contents
  • Filter Finder Items
  • Copy Finder Items
| improve this answer | |
  • Thanks would this copy within subfolders also or i need to add recursive option in the cp command? – sd100 Dec 3 '19 at 8:11
  • @sd100, Sorry, I missed the subfolder part in your OP, use the Automator workflow instead. – user3439894 Dec 3 '19 at 8:46
  • @sd100, You could use this compound command in Terminal to do it: while IFS= read -r f; do cp -n "$f" "/path/to/destination/"; done < <(find /path/to/source -type f -iname '*.epub' 2>/dev/null) – user3439894 Dec 3 '19 at 8:58

You must log in to answer this question.

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