Permissions work.
And fixed the issue with spaces in names.
--- a/tele-watch.pl Sat Feb 28 23:42:42 2009 +0100
+++ b/tele-watch.pl Sun Mar 01 00:03:59 2009 +0100
@@ -128,6 +128,9 @@
if ($e->IN_CREATE) {
notice "new dir $fullname";
+ # find the owner and permissions
+ my ($uid, $gid, $mode) = (stat $fullname)[4,5,2];
+
foreach my $t (map { basename($_) } grep {-d} dir "$target/") {
my $dir = "$target/$t/$e->{name}";
my $link = "$fullname/$t";
@@ -135,6 +138,8 @@
if (!-e $dir) {
notice "mkdir $dir";
mkdir $dir => 0755;
+ chown($uid, $gid, $dir);
+ chmod($mode & 07777, $dir);
}
notice "symlink $dir <= $link";
@@ -204,6 +209,7 @@
sub dir($) {
my $base = shift;
+ $base =~ s/\/*$//;
opendir(my $dir, $base) or die "Can't open $base: $!\n";
return map { "$base/$_" } grep !/^(?:\.\.?)/, sort readdir $dir;
}
@@ -273,7 +279,8 @@
...
After done this it writes the name of the newly created directory into
-the file F<< <NEW1>/.name >>
+the file F<< <NEW1>/.name >>. The permissions of the newly created
+directories are taken from the parent (F<NEW1> in our example).
=item RENAMING of a directory