Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADIR bug?
Message
De
29/07/2016 10:56:25
 
 
À
29/07/2016 08:54:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8.1
Network:
Windows Server 2012
Database:
Visual FoxPro
Application:
Desktop
Virtual environment:
VMWare
Divers
Thread ID:
01638887
Message ID:
01638934
Vues:
54
Hi Tamar,

Thanks. I re-read the help file and it does indeed say that you get the files as well as the directories:

"Including D returns subdirectory names of the current directory in addition to file names that match the file skeleton specified..."

BTW, you mentioned the hackers guide being online - I lugged in the book to my office but having the online one would be helpful. Is the book online and free or was it a separate download way back when?

Albert

>>Hi all,
>>
>>Back looking at the GetDirectoryTree() function - in the current one I have (based on code by Doug Hennig and Tamar), the code does a CD to change to the appropriate directory first (at least the code that I have - they might have improved it later). (it seems to me that "CD" is kinda a "klunky" way to do this).
>>
>>But I thought, is there no way to get a list of directories using ADIR with also a file path as the "base" folder to start with? It seems not - not unless I have not yet figured out how to call ADIR()
>>
>>This works (their code):
>>
>>CD (tcBasePath)
>>ADIR(laTest,[],"D")
>>
>>These did not work (i.e. no change of directory first) as they always returned no folders or both the files and folders in that directory:
>>
>>ADIR(laTest,"F:\Office\Templates","D")
>>ADIR(laTest,"F:\Office\Templates\","D")
>>ADIR(laTest,"F:\Office\Templates\*","D")
>>
>>It seems as though ADIR() is not respecting the "D" argument - unless that means "folders in ADDITION to the files.
>>
>
>Here's what we said in the Hacker's Guide (and yes, we marked it with a bug icon):
>
>In VFP 5 and earlier, you could get a list of sub-directories for a specified directory by passing the path and a single asterisk for the file name, like this:
>
>ADIR(aSubDirs, cPath + "*", "D")
>
>This approach doesn't work in VFP 6 and later—that call results in a list containing both files and directories. In those versions, you have to change to the directory of interest and then pass the empty string for the path, like this:
>
>CD (cPath)
>ADIR(aSubDirs, "", "D")
>
>Tamar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform