Skip to content

Instantly share code, notes, and snippets.

@ollie
Created November 30, 2020 10:09
Show Gist options
  • Save ollie/77cb6906e51b31b39476ddcb2e41db1c to your computer and use it in GitHub Desktop.
Save ollie/77cb6906e51b31b39476ddcb2e41db1c to your computer and use it in GitHub Desktop.
require 'pathname'
directories = Pathname.name('.').children.select(&:directory?)
file_paths = {}
directories.each do |directory|
directory.children.each do |file_path|
basename = file_path.basename
file_paths[basename] ||= []
file_paths[basename] << file_path
end
end
file_paths.each do |basename, file_paths|
next if file_paths.size <= 1
puts "Duplicate #{basename}: #{file_paths.join(', ')}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment