deleting a folder

Hi ,

I am trying to complete an apple script to delete a folder as follow:


do shell script "rm -Rf ~/Library/Application Support/Audio Mixing/

due to the presence of spaces in the path, it is not working. I also, did the following:


set folderPath to “~/Library/Application Support/Audio Mixing”
do shell script "rm -Rf folderPath
when I run it, the event log shows the operation and path correctly, but the folder is not getting deleted…

Could anyone help me resolve this problem.

thanks,
Tommy

Hi,

space characters must be escaped with a backslash, in AppleScript the backslash itself must be escaped with a second one


do shell script "rm -Rf ~/Library/Application\\ Support/Audio\\ Mixing/"

or the whole path must be quoted (single or double quotes), but the tilde will cause problems


do shell script "rm -Rf '/Users/myUser/Library/Application Support/Audio Mixing/'"

right, I fixed it

thank you Tom this works.

You’re welcome! :wink: