Skip to content

Instantly share code, notes, and snippets.

@rjungemann
Created January 7, 2011 21:46
Show Gist options
  • Select an option

  • Save rjungemann/770165 to your computer and use it in GitHub Desktop.

Select an option

Save rjungemann/770165 to your computer and use it in GitHub Desktop.
Checks a directory structure for files missing newlines
#!/usr/bin/env ruby
require 'rubygems'
require 'ptools'
start = ARGV.first || '.'
Dir.glob("#{start}/**/**").each do |f|
begin
next if(File.directory?(f) || File.binary?(f))
puts f unless File.read(f).split('')[-1] == "\n"
rescue Exception => e
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment