Skip to content

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

instance method

FileTest#exist?

File.exist?(file_name) → true or false

Return true if the named file exists.

file_name can be an IO object.

“file exists” means that stat() or fstat() system call is successful.

See also #executable_real? #file? #executable? #grpowned? also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0