Skip to content

Instantly share code, notes, and snippets.

@konsolebox
Created November 21, 2022 03:43
Show Gist options
  • Save konsolebox/1e613a5824b7044c2cbd0b0f2c0e9184 to your computer and use it in GitHub Desktop.
Save konsolebox/1e613a5824b7044c2cbd0b0f2c0e9184 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'find'
Find.find('.')
.inject({}) do |hash, path|
base = path.gsub(/.*\//, '')
(hash[base] ||= []) << path unless base.empty?
hash
end
.select{ |k, v| v.size > 1 }
.sort_by{ |k, v| k }
.each do |k, v|
puts "#{k}:"
puts v.sort
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment