Skip to content
class method

File.executable?

(::string | ::_ToPath file_name) -> bool
File.executable?(file_name) → true or false

Returns true if the named file is executable by the effective user and group id of this process. See eaccess(3).

Windows does not support execute permissions separately from read permissions. On Windows, a file is only considered executable if it ends in .bat, .cmd, .com, or .exe.

Note that some OS-level security features may cause this to return true even though the file is not executable by the effective user/group.

See also .empty? .executable_real? .dirname .exist? also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0