Mega Code Archive

 
Categories / Perl / File
 

File test operators

OPERATOR    DESCRIPTION -A          Age of file in days from the last access time. -B          if the file is a binary file. -C          Age of file in days from the last inode change. -M          Age of file in days when script started. -O          if the file is owned by the real user ID (UID). -R          if the file is readable by real UID or group ID (GID). -S          if the file is a socket. -T          if the file is a text file. -W          if the file is writable by real UID or GID. -X          if the file is executable by real UID or GID. -b          if the file is a block special file. -c          if the file is a character special file. -d          if the file is a directory. -e          if the file exists. -f          if the file is a plain file. -g          if the file has setgid bit set. -k          if the file has sticky bit set. -l          if the file is a symbolic link. -o          if the file is owned by effective UID. -p          if the file is a named pipe. -r          if the file is readable by effective UID or GID. -s          if the file has nonzero size and returns the size of the file. -t          if the filehandle is opened to a TTY. -u          if the file has setuid bit set. -w          if the file is writable by effective UID or GID. -x          if the file is executable by effective UID or GID. -z          if the file has zero size.