5 kx #!/usr/bin/perl
5 kx
5 kx use File::Basename;
5 kx
5 kx $base = $ARGV[0];
5 kx
5 kx open( F, '<', '.dist' ) or die "Could not open .dist";
5 kx
5 kx while( <F> )
5 kx {
5 kx chomp;
5 kx $f = "$base/$_";
5 kx unlink $f;
5 kx $dirs{dirname($f)}++;
5 kx }
5 kx
5 kx foreach ( sort { length($b) <=> length($a) } keys %dirs )
5 kx {
5 kx while( rmdir )
5 kx {
5 kx $_ = dirname( $_ );
5 kx }
5 kx }