Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADIR() to find the directories
Message
 
To
14/03/2002 05:46:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00632608
Message ID:
00632667
Views:
9
>Hi all,
>
>How can I use ADIR() or any other way to store in the array only the directory names.
>
>I am using the ADIR() function as follow :
>
> =ADIR(DIRARRAY,M.MYPATH+'\*','D')
>
>The problem is that I am getting the filenames also (not only the sub directories)
>
>Thanks in advance

Peter,

The only way to use ADIR() to return just directories is to set the default path to the desired directory. The "D" parameter is inclusive not exclusive. The documentation clearly states that you must pass an empty ("") string to retrieve only directories. When you add the path, it is not an empty string.

The data returned by ADIR() will always include the "." and ".." indicating the directory itself and its parent. Here's a sample of how to return just sub-directory.
lcpath = SYS(5) + SYS(2003)
SET DEFAULT TO (lcnewpath)
= ADIR(a_dir, "", "D")
SET DEFAULT TO (lcpath
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform