I am trying to find an elegant way to achieve a staged folder processing process. I have multiple folders with rules that work but I need them to stop processing if another folder is being processed.
Folder A: - Master sorting Folder. If there are file here other relevant folders should not process
Folder B: - This folder should process after Folder A has finished
Folder C: - This folder should process after Folder B has finished
Folder D: - This folder should process after Folder B has finished
Files only get put into Folder A. Can be a couple or can be thousands. After that everything is automated. Apart from me having to pause/resume folder rules.
So this is what I have so far. Folder A this is the first rule that creates a trigger file.
Create Trigger file
If a file does not exist (checks with shell script)
Subfolder Depth is 0
Sub-File/folder count is 0
then
Run shell script to create the file
Shell Scripts used.
- Code: Select all
#!/bin/bash
# Checking that file does exist
if [ ! -f "/Volumes/Photo-Working/Auto-Sort-Files/UnSorted-Photos-Movies/Pause-Other-Rules.tmp" ]; then
exit 0;
fi
exit 1;
/code]
[code]
#!/bin/bash
touch /Volumes/Photo-Working/Auto-Sort-Files/UnSorted-Photos-Movies/Pause-Other-Rules.tmp
[/code]
LOTS OF OTHER RULES
Delete Trigger File
If file exists
Subfolder Depth is 0
Sub-File/folder count is 1
then
Move trigger file to trash
I then have as the first condition of each rule of Folder B
Passes shell script
[code]
#!/bin/bash
# Checking that file does exist
if [ ! -f "/Volumes/Photo-Working/Auto-Sort-Files/UnSorted-Photos-Movies/Pause-Other-Rules.tmp" ]; then
exit 0;
fi
exit 1;
I was then going put in a rule to create another file in folder B as I did for Folder A for when the rules of Folder B are being processed. First problem is that I am not sure on how to delete it after the folder has been fully processed. There will still be files in that directory/sub directories.
Finally for Folders C/D/etc all their rules would have a condition that the trigger file in Folder B should not exist. They will only get their files from Folder B processes.
I am also assuming that I may have to add a touch command into the process that deletes the trigger files to reinstate a scan of the folders as Hazel may have gone through all the files finding no matches due to the condition of the non existence of the trigger files. Again not sure here.
This is all sounding very complicated and it is doing my head in.
I could not find a way to pause/stop folder rules being processed via Apple Script which would be the easiest way. Great if someone could tell me that I missed that.
Hopefully someone can point me in the correct direction.
Thanks