>The problem is though that I don't know if the directory 'progs' is a subdirectory of profiler or pro32. I do know that it is no more than 4 levels deep so I finally came up with the following:
>
>DO CASE
> CASE DIRECTORY(sys(2003)+'\'+'progs')
> thisform.pdir=FULLPATH(sys(2003)+'\'+'progs')
> CASE DIRECTORY(sys(2003)+'\'+'..\progs')
> thisform.pdir=FULLPATH(sys(2003)+'\'+'..\progs')
> CASE DIRECTORY(sys(2003)+'\'+'..\..\progs')
> thisform.pdir=FULLPATH(sys(2003)+'\'+'..\..\progs')
> CASE DIRECTORY(sys(2003)+'\'+'..\..\..\progs')
> thisform.pdir=FULLPATH(sys(2003)+'\'+'..\..\..\progs')
> OTHERWISE
> thisform.pdir=FULLPATH('progs')
>ENDCASE
>It's not pretty, but it works.
>Thanks all for your help!
Hi Tracy,
The following code should work with any level of subdirectories.
lcCurrPath = Fullpath("")
lcSubdir = "prgs"
lnCnt = 1
lcRelativePath = lcSubdir
FOR lnLevel = Occurs("\", lcPath) TO 1 STEP -1
lcTestPath = Left(lcPath, Rat("\", lcPath, lnCnt))
IF Directory(lcTestPath + lcSubDir)
lcRelativePath = lcCurrPath + Replicate("..\", lnCnt-1) + lcSubdir
EXIT
ENDIF
lnCnt = lnCnt + 1
ENDFOR
? lcRelativePath
? Fullpath(lcRelativePath )
Just remember that I did only limited testing.
--sb--