Skip to main content
Question

Removing Directory in user Folder

  • May 4, 2017
  • 5 replies
  • 8 views

Forum|alt.badge.img+4

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

mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • May 4, 2017

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.


Forum|alt.badge.img+14
  • Valued Contributor
  • May 4, 2017

~duplicate~


Forum|alt.badge.img+14
  • Valued Contributor
  • May 4, 2017

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


Forum|alt.badge.img+3
  • New Contributor
  • May 4, 2017

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


Forum|alt.badge.img+4
  • Author
  • Contributor
  • May 5, 2017

@tthurman this worked great! Thank you.