Run shell script (shell script batch processes)

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

Moderator: Mr_Noodle

Hi:

I am attempting to troubleshoot a logic problem with my Hazel rule and embedded run shell script (a python script).

When I run the python script from Terminal, the script processes all contents of a folder. It is how the script is written versus my entering a parameter in the script execution. So if there are 10 files in the folder, the script processes all 10 files. Then shows me the output of those 10 files in Terminal.

Hazel does not process batch. Hazel processes 1 file at a time within a folder.

I am trying to work out how to get these 2 bits of logic to work together. Currently I am observing the python script being run for all folder contents, x times the number of contents in the folder e.g. 10 times versus Once for the 10 items in the folder.


Questions
1 Is there a way to tell Hazel to run the action only once for all the contents of the folder?
2 One possible solution, is only pass 1 of the files into the folder that the python script runs, so effectively forcing the python script to be single file process. I know how to check folder count when the folder count is the folder the hazel rule is on. I do not know how to check folder count of another folder (e.g. the destination folder). Is this possible with the Hazel rule parameters?


Thankyou for your help.
NoodleNewbie
 
Posts: 34
Joined: Fri Jul 13, 2018 5:17 pm

Short of modifying the script, you can instead have Hazel monitoring the folder that contains the folder you want to process. Set up the rule to match that folder and have the script process that folder as the argument.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support