Removing Directory in user Folder

Jae
New Contributor III

Hello,

Im trying to remove the Office 2011 data folder for users. I have not had success wit hit.

I tried to create a policy via composer as a DMG to uninstall and no remove scripts are working. Its the folder under Documents/Microsoft User Data

5 REPLIES 5

mm2270
Legendary Contributor III

This should be pretty simple to do with a script. Are you looking to remove the directory from just a single user, like the logged in or main user of the machine, or just any of them?
I wouldn't even try doing this with a DMG set to uninstall. That isn't going to work very well in this case.

tthurman
Contributor III

~duplicate~

tthurman
Contributor III

Depending on how you're trying to do it... You could do this

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

rm -rf /Users/$loggedInUser/Documents/Microsoft User Data/path/

Regards,
TJ

edelcastillo
New Contributor II

Try :

rm -rf /Users/$3/Documents/Microsoft User Data/       - this will delete the Microsoft user Data folder


rm -rf /Users/$3/Documents/Microsoft User Data/*   -this will delete the items inside Microsoft Data Folder

Basically,just replace the loggedon username with $3

Jae
New Contributor III

@tthurman this worked great! Thank you.