RosettaCodeData/Task/Check-that-file-exists/Phix/check-that-file-exists.phix
2016-12-05 23:44:36 +01:00

18 lines
411 B
Text

constant fd = {"file","directory"}
procedure check(string name)
object d = dir(name)
if sequence(d) then
d = (find('d',d[1][D_ATTRIBUTES])!=0)
printf(1,"%s %s exists.\n",{fd[1+d],name})
else
printf(1,"%s does not exist.\n",{name})
end if
end procedure
check("input.txt")
check("docs")
check("/input.txt")
check("/docs")
check("/pagefile.sys")
check("/Program Files (x86)")