I have a script that runs and deletes the home directories of users
userList=find /Users -type d -maxdepth 1 -mindepth 1 -not -name "." -not -name "admin" -not -name "testuser" -not -name "Shared" -not -name "Guest" -mtime +7 | awk -F'/' '{print $NF}'
for a in $userList ;
do
rm -r /Users/"$a"; #delete the home directory
echo "$a has been deleted"
let counter=counter+1
done
it deletes the home directories correctly, but when i check the System Preferences --> Users & Groups
all the deleted users names are still listed here. How do I also get those user names cleared ?
