+ Post New Thread
Results 1 to 4 of 4
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 ...
  1. #1
    ranj's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    730
    Thank Post
    98
    Thanked 42 Times in 32 Posts
    Rep Power
    25

    deleting files and folders in user areas via script

    Hi

    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.

    Thanks

  2. #2
    ranj's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    730
    Thank Post
    98
    Thanked 42 Times in 32 Posts
    Rep Power
    25
    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!!

  3. #3
    AntonioRocco's Avatar
    Join Date
    Oct 2008
    Location
    South Yorkshire
    Posts
    266
    Thank Post
    10
    Thanked 113 Times in 95 Posts
    Rep Power
    40
    Hi Ranj

    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)

  4. Thanks to AntonioRocco from:

    ranj (16th July 2010)

  5. #4
    ranj's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    730
    Thank Post
    98
    Thanked 42 Times in 32 Posts
    Rep Power
    25
    Quote Originally Posted by AntonioRocco View Post
    Hi Ranj

    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)
    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.

    Do you or does anyone know of a way to do this? Could this be done in Automator?

    Thanks

SHARE:
+ Post New Thread

Similar Threads

  1. Deleting files Via Script
    By glennda in forum How do you do....it?
    Replies: 6
    Last Post: 9th March 2010, 04:02 PM
  2. delting files from user groups script
    By liamvaughan in forum Scripts
    Replies: 2
    Last Post: 5th November 2009, 07:04 PM
  3. Replies: 5
    Last Post: 17th September 2009, 10:52 PM
  4. Problem deleting lots of folders within folders
    By sradams1977 in forum Windows
    Replies: 11
    Last Post: 13th March 2008, 05:25 PM
  5. Replies: 5
    Last Post: 9th March 2008, 12:15 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •