Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADIR discrepancy between Windows 95 and 98
Message
 
To
16/08/2000 11:36:21
Paul Mender
Mender Software Development
Edgewater, Colorado, United States
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00405552
Message ID:
00406957
Views:
16
>(Unfortunately, the code listing loses it formatting after it is posted. If anyone knows how to preserve the formatting, please let me know. Of course, it will run regardless of its readability.)
>
>*----------------------------------------------------------------
>* Program: TESTADIR.PRG
>*----------------------- Usage Section --------------------------
>*) Description:
>*) Demonstrates a discrepancy in ADIR behavior between
>*) Windows 95 and 98.
>*) In Windows 98, "*." in the file skeleton returns only
>*) the folders; in Windows 95, all files are returned.
>* Parameters:
>* 1. None
>*$ Usage:
>*$
>* Returns:
>*--------------------- Maintenance Section ----------------------
>* Notes:
>*
>* Change Log:
>* CREATED August 15, 2000 16:18:57 - PKM
>******************************************************************
>LOCAL ARRAY laSubdirs[1]
>
>LOCAL ;
> lcFileSeleton,;
> liI,;
> lnDirs
>
>lcFileSkeleton=ADDBS(CURDIR())+"*."
>
>FOR liI=1 TO 3
>
> DO CASE
>
> *-- Passing only the current directory returns
> *-- 2 folders, "." and "..".
> CASE liI=1
> lcFileSkeleton=ADDBS(CURDIR())+""
>
> *-- Returns all files and folders in current directory.
> CASE liI=2
> lcFileSkeleton=ADDBS(CURDIR())+"*"
>
> *-- In Windows 95, returns all files and folders.
> *-- In Windows 98, returns only the folders as expected.
> CASE liI=3
> lcFileSkeleton=ADDBS(CURDIR())+"*."
>
> ENDCASE
>
> *-- Get all of the subdirectories in the current
> *-- directory being processed.
> lnDirs = ADIR(laSubDirs,lcFileSkeleton,"D")
> WAIT WINDOW ;
> 'ADIR(laSubDirs,"'+lcFileSkeleton+'","D") = ';
> +ALLTRIM(STR(lnDirs))+CHR(13);
> +'press any key to continue...'
>
>ENDFOR &&* li=1 to 3

Paul,

First, using "*. " will include only those directories without a file extension. What you need to do is twofold. First, pass and empty string to the function as the file skeleton. This will return only sub-directories if "D" is passed as the parameter for the attributes. Second, passing any file skeleton will result in the function returning all files that match the skeleton because the attributes parameter is inclusive rather than exclusive.
George

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

Click here to load this message in the networking platform