title: Compare contents of 2 folders and remove files with the same name that are present in both folders
body: <p>I am currently writing a quick script in Ruby that goes through all the contents of two folders, and returns a list of all the files that are not in either of the two folders.
  Currently what I am doing is storing the paths of all the files of each directory in an array:</p>
  
  <pre><code>Find.find(dir1) do |path|
    if File.file?(path)
      directory1_files &lt;&lt; path # Add path to an array of file_paths for the 1st directory.
    end
  end # I repeat the process for the second directory and store their paths in an array called directory2_files.
  </code></pre>
  
  <p>The problem I am having is that when I try and subtract the two arrays (larger array - small array)  to get the remaining files, I get an empty array. Reason I get this is because the full paths are trying to be subtracted instead of just the basenames. Ex: ~/folder1/file.txt != ~/folder2/file.txt 
  How can I find if a file with the same name is in two folders, and remove it from a list so the only files remaining are the ones not present in both folders?</p>