On Thu, 02 Aug 2007, john wrote: > drwx------ 8 john_s domain users 4096 2007-08-01 15:26 STUDENT_A > drwx------ 10 john_s domain users 4096 2007-08-01 15:26 ANOTHERSTU_b > > So what I want to do is have a script that goes recursively through and > chown's -R the directory called STUDENT_A to be owned STUDENT_A etc. > > So that it looks like: > > drwx------ 8 student_a domain users 4096 2007-08-01 15:26 STUDENT_A > drwx------ 10 ANO_STU_B domain users 4096 2007-08-01 15:26 ANO_STU_B
If they're all in the same directory you can probably just do: cd <directory> for i in * do chown $i $i done If they're spread out a bit further you might need to do something more complex using find. TIP: Before running a script like the above for real, run it with echo in front of the important command, so you get to see what it actually does, ie. cd <directory> for i in * do echo chown $i $i done which will print out all of the chown commands which would be run. If you're happy, do it again without the echo to actually run the commands instead of printing. Gavin -- edubuntu-users mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/edubuntu-users
