joh/when-changed

Command can't be apply to a directory

danilozacyac opened this issue · 1 comments

Even though When-Changed allows you to monitor directories, it does not allow to run commands over a directory

Mac-Pro-de-Luis:~ luis$ when-changed -[vr1s] "MyDirectory" do shell script "sudo chmod -R 766 " & "/Users/Luis/Documents/Videos Chiapas" password MyPassword with administrator privileges
[6] 1327
-bash: /Users/Luis/Documents/Videos Chiapas: is a directory

your & ist not an AND to connect commands, it sends the command before it to the background.
So, your shell tries to execute "/Users/Luis/Documents/Videos Chiapas" ... and throws the error.

Use && or; instead.