38 lines
664 B
Perl
Executable File
38 lines
664 B
Perl
Executable File
#!/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.
|
|
|
|
|
|
$VERSION = "git";
|
|
$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";
|
|
}
|
|
}
|