LOCAL lcCurDir >lcCurDir = SYS(5) + SYS(2003) > >* Assumes you have directory C:\temp >CD c:\temp >MD dir1 && Create C:\temp\dir1 >MD dir2 && Create C:\temp\dir2 > >* Create table yourfile.ext in dir1 >CD c:\temp\dir1 >lnFileHandle = FCREATE( "yourfile.ext") >=FCLOSE( lnFileHandle) > >SET PATH to C:\temp\dir1 && dir1 has yourfile.ext in it >CD C:\temp\dir2 && dir2 has no files in it > >* Use FILE() to check if yourfile.ext exists >?"Path = " + SET( "path") && Confirm path points to C:\temp\dir1 >?"Curdir = " + SYS(5) + SYS(2003) && Confirm current directory is C:\temp\dir2 >?FILE( "yourfile.ext") && True because yourfile.ext is in the path >?FILE( "c:\temp\dir2\yourfile.ext") && False because yourfile.ext is not in dir2 > >CD &lcCurDirYou get the same result with the more generic SYS(2003)
?FILE( ADDBS( SYS(2003)) + "yourfile.ext") && False because yourfile.ext is not in dir2Well, try my code! Feel free to change the paths according to your setup. In this case p: is my default drive, and the path includes p:\data\
STRTOFILE('aaa','p:\data\xyz.xyz') ?FILE('p:\xyz.xyz') &&.T. which is WRONG ?FILE('p:\data\xyz.xyz') && .T. which is correct ?adir(dummy,'p:\xyz.xyz')>0 && .F. which is correct ?adir(dummy,'p:\data\xyz.xyz')>0 && .T. which is correctNB! I have no p:\xyz.xyz file!