Image

Image

Search This Blog

Wednesday, January 01, 2014

Recursively change owner/permisions

$1 is the source of the rights/ownership, $2 is the target
 
#!/bin/sh 
chmod --reference $1 $2
chown --reference $1 $2
if [ -d $1 ] 
  then 
 if [ "x`ls $1`" != "x" ] 
   then 
    for f in `ls $1` 
    do 
    $0 $1/$f $2/$f 
 done 
 fi 
fi

No comments:

Post a Comment

Blog Archive