File Tests method list : File tests « File Directory « Ruby






File Tests method list


Test    Returns     Meaning
?A      Time        Last access time for file1
?b      Boolean     True if file1 is a block device
?c      Boolean     True if file1 is a character device
?C      Time        Last change time for file1
?d      Boolean     True if file1 exists and is a directory
?e      Boolean     True if file1 exists
?f      Boolean     True if file1 exists and is a regular file
?g      Boolean     True if file1 has the \CF{setgid} bit set (false under NT)
?G      Boolean     True if file1 exists and has a group ownership equal to the caller's group
?k      Boolean     True if file1 exists and has the sticky bit set
?l      Boolean     True if file1 exists and is a symbolic link
?M      Time        Last modification time for file1
?o      Boolean     True if file1 exists and is owned by the caller's effective uid
?O      Boolean     True if file1 exists and is owned by the caller's real uid
?p      Boolean     True if file1 exists and is a FIFO
?r      Boolean     True if file1 is readable by the effective uid/gid of the caller
?R      Boolean     True if file1 is readable by the real uid/gid of the caller
?s      Int/nil     If file1 has nonzero size, return the size; otherwise return nil
?S      Boolean     True if file1 exists and is a socket
?u      Boolean     True if file1 has the setuid bit set
?w      Boolean     True if file1 exists and is writable by the effective uid/gid
?W      Boolean     True if file1 exists and is writable by the real uid/gid
?x      Boolean     True if file1 exists and is executable by the effective uid/gid
?X      Boolean     True if file1 exists and is executable by the real uid/gid
?z      Boolean     True if file1 exists and has a zero length

 








Related examples in the same category

1.File tests for two files
2.Testing single files
3.# Comparing two files f and g