This repository has been archived on 2019-12-04. You can view files and clone it, but cannot push or open issues or pull requests.
simple-audiotools/dirclean

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";
}
}