All pastes #2064837 Raw Edit

Anonymous

public text v1 · immutable
#2064837 ·published 2011-05-19 15:56 UTC
rendered paste body
#!/usr/bin/perl
use DNS::ZoneParse;

my @list = dirdetails($ARGV[0]);
treemanage(@list);
#Manage a recursive tree
sub treemanage
{
#       foreach my $list (@_) {
#               print "$list\n";
#       }
        foreach $file (@_) {
                if ($file eq "." or $file eq "..") {
                        next;
                }
                elsif (-f $file) {
                        print "$file\n";
#                       zonemanage($file);
                }
                elsif (-d $file) {
                        print "$file\n";
#                       my @details = dirdetails($file);
#                       treemanage(@details);
                }
                else {
                        next;
                }
        }
}

#Read Directory Contents
sub dirdetails
{
        opendir (DIR, $_[0]);
        my @files = readdir(DIR);
        closedir(DIR);
        my @ret;
        foreach my $f(@files) {
               push @ret, $_[0]."/".$f if ($f !~ /^\.$/ and $f !~ /^\.\.$/)
        }
        return @ret;
}