All pastes #101612 Raw Edit

jamessan

public text v1 · immutable
#101612 ·published 2006-07-27 00:41 UTC
rendered paste body
#!/usr/bin/env perl -w
use strict;

sub printdir
{
    my $dir = shift(@_);
    my $indent = shift(@_);

    opendir(DIR, $dir) || die;
    for my $file (readdir(DIR)) {
        if (-d "$dir/$file" and $file !~ m/^\.\.?$/) {
            print "   " x $indent;
            print "$file\n";
            printdir("$dir/$file", $indent + 1);
        }
    }
    closedir(DIR);
}

printdir($ARGV[0], 0);