Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Applescript oe shellscript to delete config file?

Hi All,

pls suggest how do i delete config file with permissions, with my scripts .cfg file is not deleting. I tried with applescript and shell script both, but its not working.. and also its not asking for permissions as well..


tell application "System Events"
    delete  file "/Library/Application Support/Macromedia/abc.cfg"
end tell

do shell script "rm -f /Library/Application Support/Macromedia/abc.cfg"

Mac OS X (10.7.4)

Posted on Dec 18, 2012 10:11 PM

Reply
Question marked as Best reply

Posted on Dec 18, 2012 11:10 PM

If you use 'do shell script' you'll need to escape the spaces in path, either by quoting the entire path, or by using backslashes:


do shell script "rm -f '/Library/Application Support/Macromedia/abc.cfg'"

The 'pure' AppleScript solution likely doesn't work because System Events isn't used to handling files. Try asking the Finder to delete the file instead.


Of course, both methods assume you have sufficient privileges.

2 replies
Question marked as Best reply

Dec 18, 2012 11:10 PM in response to madhusudhanjr

If you use 'do shell script' you'll need to escape the spaces in path, either by quoting the entire path, or by using backslashes:


do shell script "rm -f '/Library/Application Support/Macromedia/abc.cfg'"

The 'pure' AppleScript solution likely doesn't work because System Events isn't used to handling files. Try asking the Finder to delete the file instead.


Of course, both methods assume you have sufficient privileges.

Applescript oe shellscript to delete config file?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.