|
|
|
#*****************************************************************#
# ALLGEMEIN: #
# Ordner anlegen #
#*****************************************************************#
use includedatei;
my $pfad = '/home/www/htdocs/bild/auto/';
includedatei->ordner($pfad);
#*****************************************************************#
# Subroutine #
#*****************************************************************#
sub ordner()
{
($self, $ganz) = @_;
# kompletter Pfad existiert bereits
if(-d $ganz){return $ganz}
$ganz =~ s/\\/\//g;
# LINUX
if ($ganz =~ s/^\///) {$start = ""}
# WINDOWS
elsif($ganz =~ s/^(\w\:)\///) {$start = $1 }
# Pfad splitten und Ordner anlegen
my @teil = ();
@teil = split('/', $ganz);
$TEIL = $start;
while(@teil) {
$TEIL .= '/' . shift(@teil);
# Unterordner existiert
if(-d $TEIL) { next; }
# Unterordner anlegen
if(!-d $TEIL) { mkdir($TEIL, 0755); }
}
return 1;
}
|