Class: Dir

Inherits:
Object
  • Object
show all
Defined in:
lib/dir.rb

Class Method Summary collapse

Class Method Details

.real_entries(path) ⇒ Object



2
3
4
5
6
7
# File 'lib/dir.rb', line 2

def self.real_entries(path)
  Dir.entries(path).select do |entry|
    absolute_path = path + '/' + entry
    !File.symlink?(absolute_path) && entry != '.' && entry != '..'
  end
end

.size(path) ⇒ Object



9
10
11
12
13
14
# File 'lib/dir.rb', line 9

def self.size(path)
  if Dir.exists? path
    size = `du -ks "#{path}" 2> /dev/null`
    size.split("\t").first.to_i*1024 if size != ''
  end
end