/home/vize/units/11780540/moving_code_AFT /home/vize/units/91540670/moving_code_INT ..etc #### #!/usr/bin/perl use strict; use warnings; my $UNIT_DIR = '/home/vize/units'; # Get all units in $UNIT_DIR my $dh; opendir $dh, $UNIT_DIR or die "Couldn't open dir '$UNIT_DIR': $!"; my @units = grep { !/^\.\.?$/ } readdir $dh; closedir $dh; if ( @units ) { foreach my $unit (@units) { my $moving_code_dir = glob("$UNIT_DIR/$unit/moving_code_*"); my $moving_code = (split("/",$moving_code_dir))[-1]; if ( $moving_code_dir ) { print "$unit good\n"; } else { print "$unit bad\n"; } } } #### 00116122 good 00114295 bad 00114952 good 00116121 bad 00117351 good 00114294 bad 00114293 good 00114292 bad 00114291 good 00117349 bad 00116120 good 00116119 bad