Go Back   The UNIX and Linux Forums > Special Forums > Hardware > Filesystems, Disks and Memory
.
google site




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 05-03-2006
x96riley3 x96riley3 is offline
Registered User
 

Join Date: Mar 2006
Location: Nashville
Posts: 79
The best way to do this is with PERL. Perl can walk a file system faster than anything else. Do something like this.

#!/opt/perl/bin/perl

use File::Find;
find \&wanted, "/";
sub wanted {

my $dev; # the file system device number
my $ino; # inode number
my $mode; # mode of file
my $nlink; # counts number of links to file
my $uid; # the ID of the file's owner
my $gid; # the group ID of the file's owner
my $rdev; # the device identifier
my $size; # file size in bytes
my $atime; # last access time
my $mtime; # last modification time
my $ctime; # last change of the mode
my $blksize; # block size of file
my $blocks; # number of blocks in a file

#Right below here your telling lstat to retrieve all this info on each and every file/directory. Each and every file/directory is w
ritten to $_.

(($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = lstat($_));

if ($gid <= "99" ) {
$NEWGID=$gid+99;
print "old $gid\n";
print "new $NEWGID\n";
system "chgrp $NEWGID $_;
}
}

I'm not sure if this is perfect but it should be pretty close.

-X