We have a couple of script needs that are similar and involve deleting specific files within a user's profile. One example is Hotspot Shield. This app only has 5 things to delete, so we have used a script like I've listed below, and pushed it out as a policy using the every5 to make sure users are not reinstalling it.
sudo rm -r ~/Library/Caches/com.anchorfree.hss
sudo rm -rf ~/Library/Caches/com.anchorfree.Hotspot_Shield
sudo rm ~/Library/Preferences/com.anchorfree.Hotspot_Shield.plist
sudo rm -rf /Library/ApplicationSupport/HotsportShield
sudo rm -rf /Applications/HotspotShield.app
When it executes, we see a log file that looks like this, and does not indicate a problem. It does not delete the items that are listed.
unning script Hotspot Shield Removal Script.sh...
Script exit code: 0
Script result: rm: /var/root/Library/Caches/com.anchorfree.hss: No such file or directory
rm: /var/root/Library/Preferences/com.anchorfree.Hotspot_Shield.plist: No such file or directory
Unmounting file server...
Displaying message to end user...
I am new to scripting on Macs, so I'm not really sure where the issue lies. Can anyone provide some guidance? I've tried searching the site for the last couple of days, and have not found anything useful.
Thanks
Mike