Obtaining the Parent folder of a file/folder

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

Moderator: Mr_Noodle

Hi All@Noodlesoft Forum,

I'm wondering if Hazel is capable of doing a such job :

- Monitor a Folder (Yes, Hazel can does this !)
- When an incoming Folder appears (containing files and/or folders),
- Launch an action to change ower/group for files/folders,
- And also applying owner/group changes for the Parent folder.

Example :
/path/monitor/by/hazel/MONITORED_FOLDER/JOBS

When a file folder appears inside JOBS, doing a shell script like :

Code: Select all
/usr/sbin/chown -R User:Group /path/monitor/by/hazel/MONITORED_FOLDER/JOBS/* && /usr/sbin/chmod -R 775 /path/monitor/by/hazel/MONITORED_FOLDER/JOBS/*

I know that we can use "$1" as a variable for the file, but how Hazel can be setup to proceed as the above command ?

Last question : does Hazel also work if a file/folder is changing ?

Thanks for clues and replies ;-)
trouspinette
 
Posts: 11
Joined: Tue Jan 27, 2015 9:43 am

You would use" $1" to match the file/folder being matched. To get the parent, you can use 'dirname'.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron