Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Directory() command

Status
Not open for further replies.

KellysClipper

IS-IT--Management
Mar 27, 2001
16
US
I know how the Directory() function works, but is there any other function similar to it that will generate an array or list of EVERY file of a certain file type on a drive letter no matter what directory or sub-directory it is in? What I am looking for is something that will produce an array with filenames - including full paths - of all DBF files on a hard drive (similar to the "DIR C:\*.DBF /B /S" Dos command.)

I could write my own function to do that using various instanceses of the Directory() function, but if it's already done somewhere, why re-invent the wheel.

Thanks for your help.

Kelly
 
Clipper Programming Guide by Rick Spence gives snippets of such recursive code which could be useful to you. Try it and all the best.

Subra if you find this useful let me know at vksubra@usa.net
 
I use the function ADIR(). It does all you ask and
more...

1. Construct a variable containing the path and wildcards
of the DOS files you wish to overlay/select from.
e.g. overlay := "C:\ANNA\*.TXT"
2. xqty = ADIR(overlay)
i.e. the answer is the number of files that match
3. Define the elements of the filespecs to examine...
DECLARE fname(xqty)
DECLARE fdate(xqty)
DECLARE fok(xqty)
AFILL(fok,.T.) && if you want them menu selectable
4. Perform the ADIR() again but this time extend your array
ADIR(overlay,fname,"",fdate,"",fok)
5. Do whatever you like with the resulting file details
now sorted in ascending alpha sequence on filename.


Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top