my $directory = 'c:\midicsv\newmidi'; opendir(DIR,$directory); my @files = readdir(DIR); closedir(DIR); #the following line is not truly necessary but I left it in so I could see that the file names were being captured. foreach(@files){ print $_,"\n";} #this is the line giving me trouble, foreach(@files) {system("c:\midicsv\midicsv.exe", "c:\midicsv\newmidi\$_", "c:\midicsv\newcsv\$_");}