/[corp_html]/.data/save_perm.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /.data/save_perm.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Thu Mar 21 09:57:40 2002 UTC (20 years, 8 months ago) by dpavlin
Branch: MAIN
Changes since 1.1: +6 -5 lines
File MIME type: text/plain
permissions

1 #!/usr/local/bin/perl -w
2
3 use English;
4 use strict;
5
6 my @dirs = @ARGV;
7
8 while (@dirs) {
9 my $curr_dir=shift @dirs;
10 opendir(DIR,$curr_dir) || warn "opendir: $!";
11 my @ignore = ('.', '..', 'CVS');
12 if (-f "$curr_dir/.cvsignore") {
13 open(I,"$curr_dir/.cvsignore");
14 while(<I>) {
15 chomp;
16 push @ignore,$_;
17 }
18 close(I);
19 }
20 print STDERR "ignore: ",join("|",@ignore);
21 my @clutter = readdir(DIR);
22 foreach my $file (@clutter) {
23 if (-l "$curr_dir/$file" && grep(/^\Q$file\E$/,@ignore) == 0) {
24 my $dest=readlink("$curr_dir/$file");
25 $dest="$curr_dir/$dest" if (substr($dest,0,1) ne "/");
26 print "ln -sf $dest $curr_dir/$file\n";
27 } elsif ((-f "$curr_dir/$file" || -d "$curr_dir/$file") && grep(/^\Q$file\E$/,@ignore) == 0 && -r "$curr_dir/$file") {
28 my (undef,undef,$mode,undef,$uid,$gid) = stat("$curr_dir/$file");
29 if ( $uid != $UID || $gid != $GID ) {
30 print "chown ",(scalar(getpwuid($uid)) || $uid),":",(scalar(getgrgid($gid)) || $gid)," $curr_dir/$file\n";
31 printf "chmod %04o %s\n", ($mode & 07777), "$curr_dir/$file";
32 }
33 push @dirs,"$curr_dir/$file" if (-d "$curr_dir/$file");
34 } else {
35 print STDERR "skip: $curr_dir/$file\n";
36 }
37 }
38 }

  ViewVC Help
Powered by ViewVC 1.1.26