MacOS – How to get Automator to “Copy Finder Items” and only keep one copy

automatorfindermacos

I've build a short Automator workflow.

It does a "Get Specified Finder Items" from directory "sourcesfiles".

Then does a "Copy Finder Items" to directory "targetdir". The "Replace Existing Files" is unchecked.

I have a cron job set up to run it every 2 minutes. It runs and works. It copies the "sourcefiles" directory to the "targetdir/sourcefiles".

However, when the files are deleted from the "sourcefiles" directory, it copies an empty directory to "targetdir" … that is, the backed up files in "targetdir" get deleted.

I tried checking the "Copy Finder Items > Replace Existing Files" checkbox. But then it created a new copy every time. I end up with this …

targetdir/sourcefiles

targetdir/sourcefiles copy

targetdir/sourcefiles copy 2

targetdir/sourcefiles copy 3

targetdir/sourcefiles copy 4

… and so on.

QUESTION: How can I make automator make one copy of the newest file, but not delete the backup when the original file gets deleted?

Best Answer

I believe the following workflow answers your question: "How can I make automator make one copy of the newest file, but not delete the backup when the original file gets deleted?"

Automator Workflow