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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Move all *.dbf names in a selected directory to an array

Status
Not open for further replies.

marka1966

Programmer
Oct 9, 2002
19
0
0
US
I am working on a FPW 2.6 program that checks the field names, data type, size, etc. against a template dbf.

All I want the user to do is select any .dbf file in a directory and the program will then retrieve all the .dbf files in the directory and store the file names to an array to be processed later.

Probably pretty straight forward but I have gone brain dead on the subject.

Can anybody help?

MarkA1966
 
How about:
Code:
lcDir = getdir()
IF !empty(lcDir)
  lnFiles = adir(larray, lcDir+"*.DBF")
  IF lnFiles > 0
     list memo like larray
  ENDIF
ENDIF
Rick

 
Thanks.
I told you I was just brain dead.

Marka1966
 
Rick's response will get you a good bit of the way there. It will get you a list of the DBF files contained in the directory and store them into the Array lArray.

Now you need to use those names and get their field properties to compare them to your "template". To do that you will need to use the =AFIELDS() command.

Example:
m.nArrLen = ALEN(lArray,1)
IF m.nArrLen > 1
FOR i = 1 TO m.nArrLen
m.cDBFName = lArray(i,1)
m.cAlias = JustStem(m.cDBFName)
m.cDBF = lcDir + "\" + m.cDBFName
USE (m.cDBF)
SELECT (m.cAlias)

* --- Load Field Properties Into Array ---
=AFIELDS(lFldArray)

<whatever comparison you need to do>

SELECT (m.cAlias)
USE
ENDFOR
ENDIF

Good Luck,
JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
Thank you,

More help than I had expected.

Marka1966
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top