I have a folder called f:\convert that is populated with .txt files. How can I have foxpro store the filenames (ex. 123456.txt ) to a dbf file . Ideally, the dbf file ( ex. convert.dbf ) will contain one field that is character type with a length of 10 .
This is similar to Jim's post, but you may find it a bit more robust when there are no files present. Also, I've added your actual path as well as a memo field to contain the path and filename regardless of how long the path might get.
Brian
CREATE TABLE textfiles (filename c(10),withpath m)
lnFileCnt = ADIR(laFileArray,'f:\convert\*.txt')
IF lnFileCnt > 0
FOR lnFile = 1 TO lnFileCnt
APPEND BLANK
REPLACE filename WITH laFileArray(lnFile,1)
REPLACE withpath WITH FULLPATH(laFileArray(lnFile,1))
ENDFOR
ELSE
WAIT WINDOW "No Files Found" NOWAIT
ENDIF
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.