def flattened_filenames(filenames)
      # Expect an array of filenames return otherwise
      return filenames if !filenames.is_a?(Array)
      # Iterate through array
      filenames.map! do |filename|
        # Flatten if its a file, flatten if a dir.
        Dir.exist?(filename) ? directory_to_filenames(filename) : filename
      end
      # Flattern the array and remove all nils
      filenames.flatten.compact
    end
def flattened_filenames(filenames)
      # Expect an array of filenames return otherwise
      return filenames if !filenames.is_a?(Array)
      # Iterate through array
      filenames.map! do |filename|
        # Flatten if its a file, flatten if a dir.
        Dir.exist?(filename) ? directory_to_filenames(filename) : filename
      end
      # Flattern the array and remove all nils
      filenames.flatten.compact
    end
Creates an array consisting of only files contained in a directory and its subdirectories.

 Expects an array of filenames or dirnames or a combination of both.