Thread Chmod von Dateien in einem Ordner? (1 answers)
Opened by Gast at 2006-12-29 00:07

renee
 2006-12-29 10:06
#9404 #9404
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
ungetestet:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl

use strict;
use warnings;

my %dir_chmod = (x => 0777,
z => 644);
my %file_chmod = (x => 644,
y => 666,
z => 644);

mychmod('dir',%dir_chmod);
mychmod('file',%file_chmod);

sub mychmod{
my ($type,%hash) = @_;

for my $dir(keys %hash){
opendir DIR, $dir or die $!;
my @entries = map{$dir . '/' . $_}
grep{!/^\.\.?$/ and
($type eq 'file' ? -f $_ : -d $_)}readdir DIR;
closedir DIR;
chmod $hash{$dir},@entries;
}
}
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Chmod von Dateien in einem Ordner?