Sorry for the confusion.
"Move folder to trash" shouldn´t be there.
Ok, that´s what I want to do in detail:
-An external workflow produces single pdf-files, some of them are part of the same job, lets say:
job1#1.pdf - job1#10.pdf
job2#1.pdf - job2#10.pdf
job3#1.pdf - job3#10.pdf
30 single files of 3 different jobs.
They all arrive in the same folder, within about 1 minute.
I call this the BASE-FOLDER, it is the one watched by Hazel.
A rule on this folder triggers the incoming files and sorts them in subfolders within the BASE-FOLDER.
-BASE-FOLDER
--SUBFOLDER_JOB1
---job1#1.pdf - job1#10.pdf
--SUBFOLDER_JOB2
---job2#1.pdf - job2#10.pdf
--SUBFOLDER_JOB3
---job3#1.pdf - job3#10.pdf
These new SUBFOLDERS now are triggered by a rule that combines the single pdf-files to one downsized combined pdf,
done with a script that starts ghostscript to do the work.
The most important thing with this rule is that it has to wait till all of the single-pdfs of one job are sorted in, that it doesn´t start to early.
So far I have done this with a "date last modified not in the last 2 minutes" condition on the SUBFOLDERS.
This works sometimes, but:
It happens, that the single-pdfs are very, very large so that all of the single-pdfs of one job can be up to 1 GB or more of data size.
In these cases the ghostscript-rule runs for a long time, sometimes up to 15 minutes.
During these busy minutes all other Hazel rules run very slowly, sometimes they stop completely until the ghostscript rule has finished.
So it happens that a SUBFOLDER only gets the first few files of the job sorted in, whereas the rest of the files is stuck in the BASE-FOLDER because of the delay described above.
When ghostscript has finished all other rules restart or start, so does the next ghostscript-combine, probably of a still incomplete SUBFOLDER.
One solution could be to increase the "date-last modified" time, but that would on the other hand delay all smaller and so faster jobs as well.
As far as I know, a defintion of priority of rules isn´t possible, which could be a solution as well.
So my idea was to start the execution of the ghostscript-rule depending on the occurrence of files:
It should start only if the BASE-FOLDER has no incoming files anymore, if they are all sorted in in their subfolders.
That would guarantee that all job-files are complete and ready to be combined.