Skip to content

Instantly share code, notes, and snippets.

@dvdsgl
Created June 1, 2011 03:54
Show Gist options
  • Save dvdsgl/1001763 to your computer and use it in GitHub Desktop.
Save dvdsgl/1001763 to your computer and use it in GitHub Desktop.
Delete duplicate files in Ruby
#!/usr/bin/ruby
ARGV.group_by {
|file| `md5 #{file}`.split.last
}.values.map {
|dups| dups.drop 1
}.flatten.each {
|dup| File.delete dup
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment