Programming Guide


Checks whether a file exists

int sm_file_exists (char *path);

Specifies the file to check. In three-tier applications, the path can include a file access server ID in this format:
[server-id !]path

If you omit server-id, Panther looks for the file locally.



sm_file_exists lets you ascertain whether a file exists. In a three-tier environment, you can check a file on a remote file access server by prefixing the file path with the server ID.

For example, this JPL verifies the existence of file rpt.out on server oak before moving it to the local machine:

if sm_file_exists("oak!/disk/reports/rpt.out")
call sm_file_move \
("oak!/disk/reports/rpt.out", "c:\reports\rpt.out", "b")

Note: On file systems that allow file-level permissions, sm_file_exists only verifies the existence of files for which the user has read permission.

See Also

sm_file_copy, sm_file_move, sm_file_remove