Need help writing a simple script to chown files
john
lists.john at gmail.com
Thu Aug 2 17:44:26 BST 2007
Hi all,
I need help with a script that will look at the contents of a directory
and change the file ownership to be the same as the name of the file. I am using
this for our student server migration.
I used robocopy to copy the files copy over just fine, but samba makes
me the owner of the files.
like so:
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
Luckily each directory name is the same as the user who should own the file.
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
I am sure this should be really easy but my attempts to do this have
failed.
Anyway, any thoughts would be appreciated!
Thanks!
John
More information about the edubuntu-users
mailing list