Hi All,
I'm working on a script to remove content from the documents, downloads, desktop, and trash from a specific user. We have training laptops that we would like to refresh periodically. The first draft of my script is well intentioned, but it doesn't work because of two reasons:
- Script obviously runs as root, so the 'id -un' portion breaks right away.
- Even if I were to collect the correct username, the previous tech contractors at the company named the user home folders something different then the account name.
Here's what my script is currently comprised of:
#!/bin/sh
#
#
#
user=`id -un`
rm -rfv /Users/$user/Documents/*
rm -rfv /Users/$user/Downloads/*
rm -rfv /Users/$user/Desktop/*
rm -rfv /Users/$user/.Trash/*
exit 0
Does anyone else have the same use case I do or know a better route for what I'm trying to do?
Thanks for the help as always.