Am I comparing the pipe symbols |x| & |f| correctly below ?
|f| corresponds to the name of a dir
|x| corresponds to the name of a file
Dir.foreach(@sortedFilesDir) do
|f|
@fileArray.each() {
|x|
if(x.match(/^#{f}/))
puts "match - "+x+","+f
end
}
end
I’ve made a few changes:
eachs with amapand afind."match - "+x+","+fI haven’t checked that it works, though.
I hope
directory_namesdoesn’t get calculated every time the loop gets run! If it does, then you might wantdirectory_names = Dir.foreach(@sorted_files_dir).to_aat the start of the script.