Module

FileTest

FileTest implements file test operations similar to those used in File::Stat. It exists as a standalone module, and its methods are also insinuated into the File class. (Note that this is not done by inclusion: the interpreter cheats).

Public Methods
blockdev? Returns true if the named file is a block device.
chardev? Returns true if the named file is a character device.
directory? Returns true if the named file is a directory, false otherwise.
executable? Returns true if the named file is executable by the effective user id of this process.
executable_real? Returns true if the named file is executable by the real user id of this process.
exist? Return true if the named file exists.
exists? Return true if the named file exists.
file? Returns true if the named file exists and is a regular file.
grpowned? 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.
identical? Returns true if the named files are identical.
owned? Returns true if the named file exists and the effective used id of the calling process is the owner of the file.
pipe? Returns true if the named file is a pipe.
readable? Returns true if the named file is readable by the effective user id of this process.
readable_real? Returns true if the named file is readable by the real user id of this process.
setgid? Returns true if the named file has the setgid bit set.
setuid? Returns true if the named file has the setuid bit set.
size Returns the size of file_name.
size? Returns nil if file_name doesn’t exist or has zero size, the size of the file otherwise.
socket? Returns true if the named file is a socket.
sticky? Returns true if the named file has the sticky bit set.
symlink? Returns true if the named file is a symbolic link.
writable? Returns true if the named file is writable by the effective user id of this process.
writable_real? Returns true if the named file is writable by the real user id of this process.
zero? Returns true if the named file exists and has a zero size.
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.