#!/usr/contrib/bin/perl # # fromlist(currentOWNER) = NEWOWNER; # $fromlist{0} = 17190; $fromlist{1189} = 1890; $fromlist{442} = 3852; $fromlist{671} = 1264; # # perform an "ls -l" then remove all # duplicate spaces using 'ts -s " " " "' # open(LSLIST, ' ls -l | tr -s " " " "|') || die "can perform an ls ?"; while () { # # remove the Carriage Return (newline) # chop; # # parse the line # ($perms,$junk,$owner,$group,$size,$mon,$day,$time,$filename) = split(/ /); # # make sure it is a file and not a directory/symbolic link # if (substr(${perms},0,1) eq "-") { # # get the OWNER - note the use of the "-u" option # $uid=`id -u ${owner}`; # # chop off the Newline # chop($uid); # # make sure the OWNER is in our list of OWNERS to change # if ($fromlist{$uid} ne "") { $cmd=`chown $fromlist{$uid} ${filename}`; } } } #