fork download
  1. a = ['1.mp3', '2.aac', '3.wav']
  2. b = ['1.flac', '3.flac']
  3.  
  4. a_filenames_mapping = Hash[a.map{ |x| [File.basename(x, File.extname(x)), x] }]
  5. p a_filenames_mapping
  6.  
  7. b_filenames_mapping = Hash[b.map{ |x| [File.basename(x, File.extname(x)), x] }]
  8. p b_filenames_mapping
  9.  
  10. differing_files = a_filenames_mapping.keys - b_filenames_mapping.keys
  11. p differing_files
  12.  
  13. differing_filenames = differing_files.map{ |x| a_filenames_mapping[x] }
  14. p differing_filenames
Success #stdin #stdout 0.02s 7456KB
stdin
Standard input is empty
stdout
{"1"=>"1.mp3", "2"=>"2.aac", "3"=>"3.wav"}
{"1"=>"1.flac", "3"=>"3.flac"}
["2"]
["2.aac"]