new

File.new(filename, mode="r" [, opt]) â fileFile.new(filename [, mode [, perm]] [, opt]) â file Class Public methods Opens the file named by filename according to the given mode and returns a new File object. See IO.new for a description of mode and opt. If a file is being created, permission bits may be given in perm. These mode and permission bits are platform dependent; on Unix systems, see open(2) and chmod(2) man pages for details. Examples f = File.new("testfil

mtime

File.mtime(file_name) â time Class Public methods Returns the modification time for the named file as a Time object. file_name can be an IO object. File.mtime("testfile") #=> Tue Apr 08 12:58:04 CDT 2003

lstat

File.lstat(file_name) â stat Class Public methods Same as File::stat, but does not follow the last symbolic link. Instead, reports on the link itself. File.symlink("testfile", "link2test") #=> 0 File.stat("testfile").size #=> 66 File.lstat("link2test").size #=> 8 File.stat("link2test").size #=> 66

link

File.link(old_name, new_name) â 0 Class Public methods Creates a new name for an existing file using a hard link. Will not overwrite new_name if it already exists (raising a subclass of SystemCallError). Not available on all platforms. File.link("testfile", ".testfile") #=> 0 IO.readlines(".testfile")[0] #=> "This is line one\n"

lchown

File.lchown(owner_int, group_int, file_name,..) â integer Class Public methods Equivalent to File::chown, but does not follow symbolic links (so it will change the owner associated with the link, not the file referenced by the link). Often not available. Returns number of files in the argument list.

lchmod

File.lchmod(mode_int, file_name, ...) â integer Class Public methods Equivalent to File::chmod, but does not follow symbolic links (so it will change the permissions associated with the link, not the file referenced by the link). Often not available.

join

File.join(string, ...) â path Class Public methods Returns a new string formed by joining the strings using File::SEPARATOR. File.join("usr", "mail", "gumby") #=> "usr/mail/gumby"

identical?

File.identical?(file_1, file_2) â true or false Class Public methods Returns true if the named files are identical. file_1 and file_2 can be an IO object. open("a", "w") {} p File.identical?("a", "a") #=> true p File.identical?("a", "./a") #=> true File.link("a", "b") p File.identical?("a", "b") #=> true File.symlink("a", "c") p File.identical?("a", "c") #=> true open("d", "w") {} p File.identical?("a", "d") #=> false

grpowned?

File.grpowned?(file_name) â true or false Class Public methods Returns true if the named file exists and the effective group id of the calling process is the owner of the file. Returns false on Windows. file_name can be an IO object.

ftype

File.ftype(file_name) â string Class Public methods Identifies the type of the named file; the return string is one of âfile'', âdirectory'', âcharacterSpecial'', âblockSpecial'', âfifo'', âlink'', âsocket'', or âunknown''. File.ftype("testfile") #=> "file" File.ftype("/dev/tty") #=> "characterSpecial" File.ftype("/tmp/.X11-unix/X0") #=> "socket"