Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

File#lstat

lstat → stat

Like File#stat, but does not follow the last symbolic link; instead, returns a File::Stat object for the link itself:

Example
File.symlink('t.txt', 'symlink')
f = File.new('symlink')
f.stat.size  # => 47
f.lstat.size # => 11
See also .lstat #flock #mtime #ctime also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0