[MacTUG] The Joys of Bookit

Dani Roloson daroloso at mfcf.math.uwaterloo.ca
Mon May 7 11:45:09 EDT 2007


I wrote a perl script to duplicate the user perms to group and other.
I ran it on the /Applications/Oracle Calendar and tested it.

Dani

#!/usr/bin/env perl -w

# recursively add the user perms to everything in a directory

use strict;
use File::stat qw(:FIELDS);

@ARGV = qw(.) unless @ARGV;
use File::Find;
find { wanted => sub {
        my $file1;
 
        $file1 = $File::Find::name;
        print $file1, -d && '/', "\n";
        stat($file1) or die "No $file1: $!";
        if ($st_mode & 0400) { # file is readable by user
                system "chmod a+r \"$file1\"";
        }
        if ($st_mode & 0200) { # file is writable by user
                system "chmod a+w \"$file1\"";
        }
        if ($st_mode & 0100) { # file is executable by user
                system "chmod a+x \"$file1\"";
        }
}, no_chdir => 1 } , @ARGV;



More information about the MacTUG mailing list