May I write that it would be useful to take care of what was already said in preceding answers ?
I wrote that your framework is not a file but a package so you must insert the option -R in the removing instruction.
In fact I wrote : insert -dr and DJ Bazzie Wazzie wrote that the option -R implies the -d one.
Here is an subset of the man page dedicated to rm :
[i] -d Attempt to remove directories as well as other types of
files.
-f Attempt to remove the files without prompting for confirma-
tion, regardless of the file's permissions. If the file does
not exist, do not display a diagnostic message or modify the
exit status to reflect an error. The -f option overrides any
previous -i options.
-i Request confirmation before attempting to remove each file,
regardless of the file's permissions, or whether or not the
standard input device is a terminal. The -i option overrides
any previous -f options.
-P Overwrite regular files before deleting them. Files are
overwritten three times, first with the byte pattern 0xff,
then 0x00, and then 0xff again, before they are deleted.
-R Attempt to remove the file hierarchy rooted in each file
argument. The -R option implies the -d option. If the -i
option is specified, the user is prompted for confirmation
before each directory's contents are processed (as well as
before the attempt is made to remove the directory). If the
user does not respond affirmatively, the file hierarchy
rooted in that directory is skipped.
-r Equivalent to -R.[/i]
property filesToDeleteFX : {"VSearch.Framework"}
repeat with aFile in filesToDeleteFX
try
do shell script "/bin/rm -R /System/Library/Frameworks/" & aFile with administrator privileges
end try
end repeat
Works flawlessly.
I wish to add that the same DJ Bazzie Wazzie urged you to remove the try / end try instructions when a piece of code doesn’t work as you assume that it must be.
Doing that, you will get an error message which ” some times ” explains clearly what is wrong.
Here is what I got without the try / end try :
property filesToDeleteFX : {"VSearch.Framework"}
repeat with aFile in filesToDeleteFX
do shell script "/bin/rm /System/Library/Frameworks/" & aFile with administrator privileges
--> error "rm: /System/Library/Frameworks/VSearch.Framework: is a directory" number 1
end repeat
We are in a case where the error message is perfectly clear.
The try / end try instructions must not be used to mask coding oddities.
Yvan KOENIG (VALLAURIS, France) samedi 27 septembre 2014 11:50:07