Admittedly I'm not great at UNIX but I managed a shell script to remove old user folders stored in a text file.

Login as root using "sudo -s" and you password then run the following script by saving as a".sh" file and using chmod 755 <FILENAME> to compile and ./<FILENAME> to run.

#! /bin/sh
while read file;
do
cd /Userdata/Data/; #SHAREPOINT


echo "Deleting" $file "from Server";

rm -rf "$file"; #Will delete the user folder based on user ID in text file
echo $file "Deleted from Macserver on "; date;
echo "\n";

done < user.txt; # file holding usernames.

This isn't the best script but it works fine for our college. If anyone has a better script I'd be more than happy to use i.