In CShell, to check for the existence of a file, use the -e option
The file name does not have to be โhard-codedโ in the if statement, but it can be such a parameter:
if (-e "$filePath") then
Here is the complete list of requests for Cshell files.
-e file file merely exists (may be protected from user) -r file file exists and is readable by user -w file file is writable by user -x file file is executable by user -o file file is owned by user -z file file has size 0 -f file file is an ordinary file -d file file is a directory
source share