Bash script fails with sub folders

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

Moderator: Mr_Noodle

Bash script fails with sub folders Wed Jan 09, 2013 10:00 pm • by scottfwalter
I have a rule: if all of the following conditions are met for any of its sub files or folders
Extension contains mov
then run shell script

Everything runs fine if I put the .mov files in the root directory (and specify the file or folder being matched) that Hazel is watching. However if its in a sub folder then Hazel indicates in the log that it did not match any files. Even if I have the .mov file in the root directory being watched Hazel won't pick it up if the condition is "Any of its sub files or folders"

What gives? It must be something simple I am missing
scottfwalter
 
Posts: 49
Joined: Thu Jan 03, 2013 11:10 am

Re: Bash script fails with sub folders Wed Jan 09, 2013 10:16 pm • by scottfwalter
Ok after looking at the sticky on subfolders I got it to work by adding the rule "Go into subfolders". I guess I don't quite understand what the condition "any of its sub-file or folders" conditions means or when I would use it.

Could someone please elaborate?
scottfwalter
 
Posts: 49
Joined: Thu Jan 03, 2013 11:10 am

Re: Bash script fails with sub folders Thu Jan 10, 2013 12:27 pm • by a_freyer
"Any of its subfolders or files" means that a folder will be matched if it contains certain things. This does not mean that those files within that folder are passed to the action section, it means the folder is passed to the action section based on the files within it.

Plain English use cases:

"I want to change this folder's color when it contains a new movie."
"I want to rename this folder if I add a certain kind of file to it."
"I want to move this folder to the trash if it contains any red-colored files."

Does that clarify?
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Bash script fails with sub folders Thu Jan 10, 2013 2:39 pm • by scottfwalter
Yes it makes sense thanks for the reply. The statement "IF all of the following condition are met for any of its subfolders" threw me off. When I saw "any of its sub files or folder" I thought it meant any files or folders under the directory that I told Hazel to watch.
scottfwalter
 
Posts: 49
Joined: Thu Jan 03, 2013 11:10 am


Return to Support