Last active
August 29, 2015 13:57
-
-
Save yangxing-star/9595928 to your computer and use it in GitHub Desktop.
输出文件路径和大小
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
photo_size = 0 | |
dirs = Dir.glob('/home/star/Documents/shou65/public/uploads/*') | |
f = File.new('/home/star/public/photo.rb', 'w') | |
Dir.glob("#{dirs.first}/*/*").each do |i| | |
unless i.include?('_') | |
f.puts "#{i} -> #{f.size}" | |
photo_size += f.size | |
end | |
end | |
f.puts "total_size => #{photo_size}" | |
f.close | |
message_size = 0 | |
dirs = Dir.glob('/home/star/Documents/shou65/public/uploads/*') | |
f = File.new('/home/star/public/message.rb', 'w') | |
Dir.glob("#{dirs.last}/*/*").each do |i| | |
unless i.include?('_') | |
unless i.include?('.mp3') | |
unless i.include?('.ogg') | |
f.puts "#{i} -> #{f.size}" | |
message_size += f.size | |
end | |
end | |
end | |
end | |
f.puts "total_size => #{message_size}" | |
f.close | |
user_size = 0 | |
dirs=Dir.glob('/home/star/Documents/shou65/public/uploads/*') | |
f = File.new('/home/star/public/user.rb', 'w') | |
Dir.glob("#{dirs[1]}/*/*").each do |i| | |
unless i.include?('_') | |
#f.puts "#{i} -> #{f.size}" | |
user_size += f.size | |
end | |
end | |
f.puts "total_size => #{user_size}" | |
f.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment