FileTest
is the collection of the file test
functions. It can be used for inclusion.
blockdev?(filename)
Returns true if the file specified by the filename is the block special file.
chardev?(filename)
Returns true if the file specified by the filename is the character special file.
executable?(filename)
Returns true if the file specified by the filename is executable by the effective user/group id.
executable_real?(filename)
Returns true if the file specified by the filename is executable by the real user/group id.
exist?(filename)
Returns true if the file specified by the filename exists.
grpowned?(filename)
Returns true if the file specified by the filename has gid of effective group.
directory?(filename)
Returns true if the file specified by the filename is a directory.
file?(filename)
Returns true if the file specified by the filename is a regular file.
pipe?(filename)
Returns true if the file specified by the filename is a named pipe (FIFO).
socket?(filename)
Returns true if the file specified by the filename is a socket.
owned?(filename)
Returns true if the file specified by the filename is owned by you.
readable?(filename)
Returns true if the file specified by the filename is readable by you.
readable_real?(filename)
Returns true if the file specified by the filename is readable by your real uid/gid.
setuid?(filename)
Returns true if the setuid bit of the file specified by the filename is set.
setgid?(filename)
Returns true if the setgid bit of the file specified by the filename is set.
size?(filename)
Returns the size of the file specified by the filename.
Returns FALSE
if it does not exist or is empty.
sticky?(filename)
Returns true if the sticky bit of the file specified by the filename is set.
symlink?(filename)
Returns true if the file specified by the filename is a symbolic link.
writable?(filename)
Returns true if the file specified by the filename is writable by you.
writable_real?(filename)
Returns true if the file specified by the filename is writable by your real uid/gid.
zero?(filename)
Returns true if the file specified by the filename exists, and the size of the file is 0.