Hi all,...
.. I'm trying to handle directories and files using recursion and some perl cookbook recipes. Basically, it all comes down to a script fragment like this: sub strip_directory { my $currentpath=$_[0]; print $currentpath;print "\n"; opendir(SOURCE, $currentpath) || die ("FATAL: Quellpfad kann nicht benutzt werden.\n"); while (defined(my $file=readdir(SOURCE))) { if ( ($file ne ".") && ($file ne "..")) { my $wkfile="$currentpath/$file"; if ( -d $wkfile ) { print "diving in...\n"; strip_directory($wkfile); } } } (hope the web-mail front-end will not mess up the script too much). Anyhow, recursion seems to work; the script cleanly dives into subdirecties and back up. Bad thing: this only happens with the _first_ subdirectory found in the tree where it is started: mail-ddn-gnu:/home/rink/prog/perl-mailadmin# perl stripmime.pl /usr/local/ /usr/local/ diving in... /usr/local//share mail-ddn-gnu:/home/rink/prog/perl-mailadmin# Besides the fact that I don't know why exactly "share" in this case is the first subdirectory to be entered: Why does the script stop after processing "share" and doesn't move on to the other sub folders? Wasn't the "while defined(..." meant to read all the stuff inside the directory used? Cheers, Kris -- +++ GMX - Mail, Messaging & more http://www.gmx.net +++ Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]