Testing file existence, permissions, and other properties

Use the filetest command to test various properties of a file handle.

You must use filetest with command syntax because the command requires a flag. Specify the flag you want to test, and give a file handle:

// Test whether the temp directory exists
//
string $tmpDir = `internalVar -userTmpDir`;
filetest -d $tmpDir;
// Result: 1 //

Refer to the MEL reference page for filetest for a full listing of the flags you can test.