Skip to content
class method

File.split

(::string | ::_ToPath file_name) -> [ ::String, ::String ]
File.split(file_name) → array

Splits the given string into a directory and a file component and returns them in a two-element array. See also File::dirname and File::basename.

Example
File.split("/home/gumby/.profile")   #=> ["/home/gumby", ".profile"]
See also .socket? .stat .size? .sticky? also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0