Unable to Delete Files

Im trying to delete three folders in below with AppleScript but they are not deleting. The script goes through like everything is OK but the files never delete.

~/Library/Group Containers/

Here is what Imm am using to delete try to delete these files. What am i doing wrong?

try
do shell script “rm -r ~/Library/Group Containers/UBF8T346G9.ms” with administrator privileges
end try
try
do shell script “rm -r ~/Library/Group Containers/UBF8T346G9.Office” with administrator privileges
end try
try
do shell script “rm -r ~/Library/Group Containers/UBF8T346G9.OfficeOsfWebHost” with administrator privileges
end try

Hi,

the issue is the space character after Group

Either escape the space with a backslash (plus a second backslash to escape the first backslash)

Group\\ Containers

or put the path component “ or the whole path “ in single quotes

'Group Containers'

An alternative is a list and a repeat loop

property itemsToDelete : {"UBF8T346G9.ms", "UBF8T346G9.Office", "UBF8T346G9.OfficeOsfWebHost"}
set groupContainer to POSIX path of (path to library folder from user domain) & "Group Containers/"

repeat with anItem in itemsToDelete
	try
		do shell script "rm -r " & quoted form of (groupContainer & anItem) with administrator privileges
	end try
end repeat