-# Read the names of all automation files in /automation/
-opendir(AUTOMATION,$sourceDirectory."/automation/") || die ($sourceDirectory."/automation: could not open!");
-while ( my $file=readdir(AUTOMATION) ) {
- if ( -f $sourceDirectory."/automation/".$file &&
- index($file,".automation") eq (length($file)-11)) {
- push(@automation,$file);
+if ( -d $sourceDirectory."/automation/") {
+ # Read the names of all automation files in /automation/
+ opendir(AUTOMATION,$sourceDirectory."/automation/") || die ($sourceDirectory."/automation: could not open!");
+ while ( my $file=readdir(AUTOMATION) ) {
+ if ( -f $sourceDirectory."/automation/".$file &&
+ index($file,".automation") eq (length($file)-11)) {
+ push(@automation,$file);
+ }