foreach my $folder (@folders) { my $folderfullpath = $componentrootpath . "/" . $folder; print "Working with folder " . $folderfullpath . "\n" if ($debug); opendir(my $folderhandle, $folderfullpath); foreach my $element (readdir($folderhandle)) { next if ($element =~ /^\./); my $quotedfullelementpath = "\"" . $folderfullpath . "/" . $element . "\""; print "\n *** Full element path: " . $quotedfullelementpath . "\n" if ($debug); next unless (-T $fullelementpath); open (FILE, "<" . $quotedfullelementpath) or die "Can't open file $quotedfullelementpath:$!\n"; while () { binmode(FILE); my $line1 = unpack("H*", $_); if ($line1 =~ /0d/) { # File is contaminated; print $quotedfullelementpath . " - contaminated\n" if ($debug); my ($elementrootname, $elementuuid) = &nameanduuid($fullelementpath); push (@contaminateduuids, $elementuuid) unless ($contaminateduuids{$elementuuid}); $contaminateduuids{$elementuuid} = 1; last; } } close (FILE); } } #### my $quotedfullelementpath = "\"" . $folderfullpath . "/" . $element . "\""; my $singlefullelementpath = "'" . $folderfullpath . "/" . $element . "'"; my $fullelementpath = $folderfullpath . "/" . $element; print "-> " .$quotedfullelementpath . " is "; print "NOT " unless (-T $quotedfullelementpath); print "a text file\n"; print "-> " .$singlefullelementpath . " is "; print "NOT " unless (-T $singlefullelementpath); print "a text file\n"; print "-> " .$fullelementpath . " is "; print "NOT " unless (-T $fullelementpath); print "a text file\n"; #### -> "/ra6535_5.ddl" is NOT a text file -> '/ra6535_5.ddl' is NOT a text file -> /ra6535_5.ddl is a text file -> "/ra6535_6.ddl" is NOT a text file -> '/ra6535_6.ddl' is NOT a text file -> /ra6535_6.ddl is a text file -> "/ra6535_7.ddl" is NOT a text file -> '/ra6535_7.ddl' is NOT a text file -> /ra6535_7.ddl is a text file -> "/ra6536_5.ddl" is NOT a text file -> '/ra6536_5.ddl' is NOT a text file -> /ra6536_5.ddl is a text file -> "/ra6536_6.ddl" is NOT a text file -> '/ra6536_6.ddl' is NOT a text file -> /ra6536_6.ddl is a text file