Applescript with terminal find and remove folders -


so want try , make script find , delete multiple folders in folder applescript:

tell application "terminal"     activate     script "find (path folder) -type d *-name "foldername*" -exec rm -rf {} \;*"  end tell 

applescript wont run after -type d because of "syntaxerror expected end of row" dont understand why because works if run

find (path folder) -type d *-name "foldername*" -exec rm -rf {} \;*  

in terminal

you use command do shell script same thing running in terminal. , don't need tell block run this.

also here 2 points @ in script.

  1. if want use " quotes in quoted shell script need escape them using \. i.e. "some script \"some name\" more script". otherwise, use single quotes in double quoted script.

  2. if want \ run in script need escape in applescript. i.e. rm -rf {} \\;*"

final script more this:

do shell script "find (path folder) -type d *-name 'foldername*' -exec rm -rf {} \\;*" 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -