Jump to content

Recommended Posts

Posted

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 to compile and ./ 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...