A, I see. No, that's not it. But I got more details that I will post in a moment.
>I haven't tried your code, only looked at it. Did I understand correctly that MenuID is sort of identity field (auto-increment)? If yes, I was just suggesting to use AutoInc keyword for MenuID in the CREATE CURSOR.
>
>>>GO BOTTOM, APPEND BLANK, REPLACE.
>>no difference.
>>>Also you may use AutoInc field for MenuID
>>What do you mean?
>>
>>>My only concern in that code would be with GO BOTTOM, APPEND BLANK, REPLACE.
>>>
>>>All of this can be replaced with one INSERT COMMAND which may be slightly faster. Also you may use AutoInc field for MenuID.
>>>
>>>Otherwise the code looks pretty standard.
>>>
>>>>OK, here:
>>>>mBuildCustomerDocumentStructure('entrypoint\*.*', 1)
>>>>
>>>>*mBuildCustomerDocumentStructure
>>>>
>>>>LPARAMETERS tcStartPoint, tnParentId
>>>>LOCAL lnFileNumber, lnMenuId, lnCount, arr
>>>>WITH This
>>>> DIMENSION arr (1, 1)
>>>> IF !USED('tree')
>>>> CREATE CURSOR tree (menuid I, parentid I NULL, name char(100), folder I DEFAULT 1)
>>>> APPEND BLANK
>>>> REPLACE menuid WITH 1, ;
>>>> parentid WITH NULL, ;
>>>> name WITH 'Customer Documents'
>>>> ENDIF
>>>> SELECT tree
>>>> lnFileNumber = ADIR(arr, tcStartPoint, 'D')
>>>> FOR lnCount = 1 TO lnFileNumber
>>>> IF arr(lnCount, 1) = '.'
>>>> LOOP
>>>> ENDIF
>>>>
>>>> GO BOTTOM
>>>> lnMenuId = menuid + 1
>>>> APPEND BLANK
>>>> REPLACE menuid WITH lnMenuId, ;
>>>> parentid WITH IIF(RECCOUNT() = 1, NULL, tnParentId), ;
>>>> name WITH IIF(RECCOUNT() = 1, 'Customer Documents', arr(lnCount, 1))
>>>> IF AT('D', arr(lnCount, 5)) # 0
>>>> .mBuildCustomerDocumentStructure(STRTRAN(tcStartPoint, '*.*', '') + arr(lnCount, 1) + '\*.*', menuid)
>>>> ELSE
>>>> REPLACE folder WITH 0
>>>> ENDIF
>>>> ENDFOR
>>>>ENDWITH
>>>>
>>>>>Hi Mark,
>>>>>
>>>>>depends on where the slowness comes from... When it's your code, we might be able to help if you show it to us. If the problem is the mere number of directories, there's little you can do except for using cached or indexed information.