>I need to check if a file c:\global\*.doc exists - what is the correct code for this?
If you know the particular filename use file(). If you want to check if any *.doc exists, you might use adir. adir builds an array filled with all matching *.doc, which could be a big array if you have many files. IMO the best way is
llFound = !empty(sys(2000,"c:\global\*.doc"))
That will tell you if there are any *.doc files. The issue is, what do you plan to do next? If you want to process all *.docs, the array may help. Or sys(2000) could be used to check for a file and then to process the remaining. That works really well and there is no upfront time spent building a potentially huge array.
lcFile=sys(2000,"c:\global\*.doc")
DO WHILE !EMPTY(m.lcFile)
lcFile=SYS(2000,"c:\global\*.doc",1)
ENDDO