Clean up Scripts

Hi
i have a perl script that i use to clean up empty folders on our server.
I need to make a amendment to this to exclude certain folders. Folders are invisible to end users but must not be cleaned up by this script.
folders i need protecting have unique names
.Highres
.HighresF
.Lowres
.lowresF

here is the script, can anyone help to modify please. I am not a scripting expert if fact not a scripting beginer :slight_smile:

#!/usr/bin/perl -w


use File::Find;
use File::Path;

my $path;


############################################################################
#       aList
# 	checks how many visible files in dir
##############################################################################
sub aList(){
my $cnt = 0;
my $filename;

	opendir(DIRHANDLE, $_) or die "couldn't open $_ : $!";
	while ( defined ($filename = readdir(DIRHANDLE)) ) {
	    #print "Inside $path is something called $filename\n";
	    if ($filename !~ /^\./){
		$cnt++;	
	    }
	}
	closedir(DIRHANDLE);

	return $cnt;
}

############################################################################
#       remDir
# 	controlled empty dir removal
##############################################################################
sub remDir()
{
    if ($_ !~ /^\./){
	if (-d $_){
		if (aList() eq 0){
			rmtree($_);
			printf "DEL $_ \n";
		}
		else{
			printf "KEEP $_ \n";
		}
	}
	else{
		print "file ".$_."\n";
	}
    }
}


##############################################################################
#	aCleanup
# 	pre-archive cleanup routine
##############################################################################
sub aCleanup(){
	print "start cleanup\n";
	
	if ($path eq ""){
		print "cleanup parameters not correctly supplied\n";
	}
	else{
		finddepth(\&remDir, $path);
	}
	print "archive move done\n";
}


##########################################################################
#
#              MAIN
##########################################################################

    if ($#ARGV >= 0){
    	print "set argv\n";
    	$path = $ARGV[0];
	print $path."\n";
    	aCleanup();

    }
    else{
	print "no args\n";
    }


Regards
Treds