Posted on 03-20-2018 12:31 PM
Hey Jamf Nation -
Apologies if this has been posted before.
Is there an easy way to delete a file with a specific extension, found in the logged in user's profile using JAMF? For example, any file with the extension of .DOC, I'd like for JAMF to find it and delete it. Is that possible?
Posted on 03-20-2018 01:02 PM
You'd probably have to make a script to do that, but you'd be using wildcards and that can be risky.
Posted on 03-20-2018 01:37 PM
I've used this to find files with .doc extension. I'm assuming you can add a for loop or something so that each entry will be deleted.
Please test, test, test before putting on JAMF Pro and run it with Check-In policy.
#!/bin/sh
loggedinuser=$(stat -f%SU /dev/console)
sudo find /Users/$loggedinuser/ -type f -name "*.doc"
Posted on 03-20-2018 02:45 PM
Thank you sooooo much! So, essentially, that script would find any files with .DOC extension and delete them?
My example was for .DOC, but I'm actually trying to delete Outlook archives/exports and didn't find a way to prevent staff from exporting from Outlook. This would save in .OLM file. So, in theory, I can substitute .DOC with .OLM and test, test, test.