Created
June 25, 2012 10:14
-
-
Save dentedtriangle/2987784 to your computer and use it in GitHub Desktop.
list files in directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'find' | |
files = {} | |
Find.find('.') do |f| | |
if(f != '.' && f != '..' && File.file?(f) && !f.include?('git')) | |
size = File.size(f) | |
if(size > 0) | |
files[f] = size | |
end | |
end | |
end | |
sorted = files.sort_by {|k,v| v}.reverse | |
i = 0 | |
sorted.each do |k,v| | |
break if i == 20 | |
puts "File: #{k} - Size: #{v}" | |
i = i + 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment