Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to do ADIR() and ASORT() using WSH
Message
 
To
31/08/2000 13:09:23
Kam Lee
SUNY-Health Science Center
Brooklyn, New York, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00411372
Message ID:
00411381
Views:
18
>Hi all,
>
>Can anybody tell me how to do ADIR() and ASORT() using WSH ?
>I am new to WSH... just wondering if this can be done without writing the sorting routine in scripting.
>
>Thanks for any input.
>
Kam,

Doing an ADIR() is simple:
oFSO = CREATEOBJECT('Scripting.FileSystemObject')
* Just folders
oFolder = oFSO.GetFolder("C:\")
DIMENSION a_folders[1]
lni = 0
FOR EACH oSubFolder IN oFolder.SubFolders
  lni = lni + 1
  DIMENSION a_folders[lni] 
  a_folders[lni] = oSubFolder.Name
NEXT
* Just files
DIMENSION a_files[1]
lni = 0
FOR EACH oFile IN oFolder.Files
  lni = lni + 1
  DIMENSION a_files[lni] 
  a_files[lni] = oFile.Name
NEXT
This will place the name of the sub-folders and files in the root of the root into arrays. You can then ASORT() them. There is no method in the WSH to return the information in order. I imagine that the Dictionary object might be useful in doing this, but don't see any reason in this case why the above solution won't do instead.
George

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

Click here to load this message in the networking platform