Dir.foreach(dir) do |f| unless f == '.' || f == '..' path = dir + "/" + f files[f] = (`du -sb #{path}`[/\d+/]).to_i end end