I have to sort 1400+ user home folders into sub folders. Is there a way to do this based on the users group membership? I am trying to avoid picking them out one by one and moving them into the new nested home folder.
Assuming you’ve got Open Directory going, you’d do something like this to get a list of users in the group ‘mygroup’:
[code]dscl /LDAPv3/127.0.0.1 -read /Groups/mygroup GroupMembership[/code]
You’ll get output like this:
[code]GroupMembership: user1 user2 user3 user4[/code]
So you’d just need to parse that output to get the individual usernames and do an mv on each username to plunk their user folder into the correct new location.
Comments are closed