Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is what I am attempting to do:

I have a folder which contains a script and a file. The file is an older copy of a file located in this path: /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A.

I am attempting to create an AppleScript that will activate Finder, open the aforementioned path, check if the file in question exists, rename that file to .new if it does, then move the older version from the folder containing the script.

Alternatively, if the AppleScript is run when the .new version of the file exists at the aforementioned path, I would like for the script to rename the older version of the file (which was previously copied) to .old and remove the .new from the original file (i.e., essentially reverse what it did previously, but without removing the file which was added).

No matter what I've tried, I've been, thus far, unable to get the script to authenticate properly to rename the file (the folder in question, obviously, requires administrator approval before any modifications may be made).

Getting the script to activate Finder and open the folder is fairly trivial (e.g., tell application "Finder" activate open ("/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A" as POSIX file) end tell works just fine), but getting the script to authenticate after that, check for the existence of the file(s), and then act accordingly has been a rather fruitless task.

Any help will be much appreciated.

share|improve this question
It might be easier to write most of this in bash, then sutheticate and run the shell script from AppleScript – Mark Oct 23 '13 at 22:47
up vote 2 down vote accepted
do shell script "
if [[ -e $d/Apple80211 ]]; then
  mv $d/Apple80211 $d/
  cp ~/path/to/Apple80211 $d/Apple80211
  mv $d/Apple80211 $d/Apple80211.old
  mv $d/ $d/Apple80211
fi" with administrator privileges
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.