carry out action only when previous action was successful

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Hi,

I'm trying to let Hazel help me to copy tagged folders to a NAS and afterwards move the source folder.
I did this with the following rule:
If "tags contain move_to_nas"
Copy to "folder on NAS"
remove tags "move_to_nas"
move to folder "copied_to_nas on local HD"

This way I can be sure that the folders in the local subfolder "copied_to_nas" are also present on the NAS.
This way, if I need space and want to remove one of the subfolders, I can do this without losing data, since the data has been copied to the NAS before.
The problem:
When the NAS is not there or is prematurely disconnected, my script continues, removing the tag and moving the folder locally.
So, I end up with a moved folder even though the folder has not been copied to the NAS.

Is there any way to only carry out folder/file actions when a previous action was successful?
If there isn't, I could put the functionality in a script and put this logic in the script, right?

Thanks in advance for your help!

Martin
mgercke
 
Posts: 2
Joined: Mon Apr 10, 2017 11:12 am

The subsequent actions should not fire if a previous one failed. Also, in your example, the subsequent actions operate on the copy, not the original.

As a result, understand that the way you have it now, you are copying a file to one place, then moving that copy elsewhere. Is there a reason why you don't just copy it directly to final destination?
Mr_Noodle
Site Admin
 
Posts: 11880
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:The subsequent actions should not fire if a previous one failed.
Also, in your example, the subsequent actions operate on the copy, not the original.


Ok, maybe that is one part of the problem.
So, my first question would be:
Can I move or copy a file and afterwards carry out an action that operates on the original?

Mr_Noodle wrote:As a result, understand that the way you have it now, you are copying a file to one place, then moving that copy elsewhere. Is there a reason why you don't just copy it directly to final destination?

What I want to accomplish is the following:
I am downloading huge files on my macbook.
I am using these on my macbook, but at some point I want to free space for new things.
Still, I need these files backed up somewhere before I can delete them.
If I were at home, I could always wait for this to happen and then select a specific file and move it to the NAS.
However, this can also happen on the road when I don't have access to my NAS.
Because of this I want them to be copied to NAS as soon as they are downloaded on my macbook.
In order to see that a copy of a file has been stored on the NAS I want to move it to a special local folder (maybe called "saved_to_nas") after it has been copied to the NAS.
This way I can be sure that I can safely delete any file in this folder when I'm on the road with my macbook.
Instead of moving the file to the local folder I could also set a flag that shows that the file has been copied to the NAS.
But when I have a look at your first remark, neither will work the way I need it, because once a file has been moved all following actions will work on the copy, not on the original, right?
In any case, is there any other way to accomplish what I want to do?
mgercke
 
Posts: 2
Joined: Mon Apr 10, 2017 11:12 am

You can try using the Sync action instead, which will mirror the file at the destination. Subsequent rules will still operate on the original.
Mr_Noodle
Site Admin
 
Posts: 11880
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support