Mega Code Archive

 
Categories / Perl / File
 

Some -X File Tests

-e        File or directory exists. -z        File is empty (zero size). -s        File is not empty; function returns size in bytes. -f        Argument is a plain file. -d        Argument is a directory. -l        Argument is a symbolic link. -p        Argument is a named pipe. -S        Argument is a socket. -b        File is a block special file. -c        File is a character special file. -t        Filehandle is an open tty (isatty()). -f        Argument is readable by effective uid/gid. -w        Argument is writable by effective uid/gid. -x        Argument is executable by effective uid/gid. -o        Argument is owned by effective uid. -R        Argument is readable by real uid/gid. -W        File is writable by real uid/gid. -X        File is executable by real uid/gid. -O        File is owned by real uid. -T        File is an ASCII text file. -B        File is a binary file. -u        Argument has setuid bit set. -g        Argument has setgid bit set. -k        Argument has sticky bit set. -M        Time in days from argument modification time to Perl program start time. -A        Time in days from argument access time to Perl program start time. -C        Time in days from argument change time to Perl program start time.