in reply to Appending to a file
and your print statement becomes print LOGFILE "\nDirectory: $file\n";