Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change teh ownership of files/dir/subdir using a script-URGENT

Status
Not open for further replies.

gjay

Technical User
Nov 15, 2001
5
AU
Hi

I would like a script which can change the ownership of files/dir/subdirs in one go. (Bourne shell, loop)

eg: owner1 ---> owner2
Thnx in advance
Gee
 
use chown -R <owner2> <dirname>. This will change ownership of the directory and everything under it.

Greg.
 
Or if you (for example) only want to change files owned by owner1, then use find :-

find startdir -user owner1 -exec chown owner2 {} \;

or use whatever criteria in the find command that applies here.
One by one, the penguins steal my sanity. X-)
 
Thank You all, that was exactly what I was looking for !!!
Pass the ownership only to the files owned by owner1 excluding the rest.
Your prompt reply is much appreciated
GEE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top