Mac Thread, deleting files and folders in user areas via script in Technical; Hi
As its coming towards the end of the year I am looking at a solution to delete all of ...
15th July 2010, 04:17 PM #1
deleting files and folders in user areas via script
As its coming towards the end of the year I am looking at a solution to delete all of year 7,8, and 9 data which is stored in their home directories on the Mac server.
All of our users have open directory accounts and rather me delete everyones account and recreate them again is there a way I can run a script or application on our Mac server for it to interregate a selection of home folders and delete all the contents in there so in September all students come back using their existing credentials and they have empty home directories?
Our storage is getting rather full and don't have the funds to buy additional storage so need to do something to clear it out a bit.
15th July 2010, 09:55 PM #2
I just found this command on the Apple website which may do the trick called 'createhomedir'. Has anyone used this command to bulk create user home directories. Mac OS X Server: How to Use createhomedir Command to Create Home Directories
I am thinking if I can delete a selection of home folders (mainly for the lower year groups) then run this command on the directory I want it to create the folders in, hopefully happy days!!
16th July 2010, 12:46 AM #3
You actually don't need to use the command line if you don't want to as what you're asking for can be easily achieved using the interface. If you want to clear space yet still keep the same User Base then simply delete (or backup if you still need them?) home folders you're not interested in any more. Launch WorkGroup Manager and authenticate to the LDAP node. Select all the Users - apart from Directory Administrator - click on the Home Tab. Select the appropriate url. Click Create Home Folder now and click Save. Navigate to the relevant folder in the Finder and watch it populate with fresh, new home folders which should have User shortnames as the name of the folder. Each folder should have the default set of folders normally associated with a mac home folder. No need to fiddle with permissions either as these will be 'set' at their defaults as the folders are created.
If you want to use Terminal, issuing this command:
sudo createhomedir -a
does the same thing only quicker.
Antonio Rocco (ACSA)
Thanks to AntonioRocco from:
16th July 2010, 11:56 AM #4
Thank you Tony for your reply I confirm this works and this will help a great deal. I am looking at another way (if possible) to recover more disk space. I was looking at if there is a way to again look at everyones home directory and delete the contents of the trash folder.
Originally Posted by AntonioRocco
Do you or does anyone know of a way to do this? Could this be done in Automator?
By glennda in forum How do you do....it?
Last Post: 9th March 2010, 04:02 PM
By liamvaughan in forum Scripts
Last Post: 5th November 2009, 07:04 PM
By dahhunter in forum Scripts
Last Post: 17th September 2009, 10:52 PM
By sradams1977 in forum Windows
Last Post: 13th March 2008, 05:25 PM
By projector1 in forum Scripts
Last Post: 9th March 2008, 12:15 AM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)