#!/usr/bin/perl
#
# Takes a directory tree and breaks it down, displaying in this format:
#
# first_dir:
# 	sub_dir1
# 	sub_dir2
# second_dir:
#	sub_dir3
#
# This information is printed to stdout.
# Further, the script only goes two levels deep.
#
# ChangeLog:
#  0.2 - aligned version with ds-audiotools
#  0.1 - initial version

$VERSION = "0.2.3";
$HELP_MSG = "# dirclean v$VERSION\n\tusage: dirclean <directory>\n\t";

foreach (@ARGV)
{
    $target = $_ unless /(-[Hh])|(--help)/;
}

foreach (`ls -1 $target`)
{
    chomp;
    $full_name = "$target/$_";
    next unless (-d $full_name);

    print "  $_:\n";
    foreach (`ls -1 $full_name`)
    {
	chomp;
	my $full_name = "$full_name/$_";
	next unless (-d $full_name);
	print "\t$_\n";
    }
}