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

Search path problem 1

Status
Not open for further replies.

Takusaan

Programmer
Sep 20, 2000
29
US
I am trying to programmatically search for an ini file on different users machines and store the results (path+filename) in a table. The problem is that I need to search into the c: drive not just the VFP 6.0 path that is set in the config.fpw. Any suggestions?
 
Code:
CREATE CURSOR iniFileCursor (FullName M)
MySearch([c:\], [MyFile.Ini])
BROWSE NORMAL

FUNCTION MySearch(lcPath, lcFileName)
   LOCAL lnFolders, lnFiles, lnFor
   LOCAL ARRAY laFolder[1], laFiles[1]
   m.lcPath  = ADDBS(m.lcPath) && I am not sure this function is in VFP6
   m.lnFolders = ADIR(laFolder,m.lcPath+[*.*],[D])
   FOR m.lnFor = 1 TO m.lnFolders
       IF NOT LEFT(laFolder[m.lnFor,1],1) == [.] AND;
          [D] $ laFolder[m.lnFor,5]
          MySearch(m.lcPath+laFolder[m.lnFor,1],lcFileName)
       ENDIF
   NEXT
   
   m.lnFiles = ADIR(laFiles,m.lcPath+m.lcFileName)
   FOR m.lnFor = 1 TO m.lnFiles
       IF NOT LEFT(laFiles[m.lnFor,1],1) == [.] AND;
          NOT [D] $ laFiles[m.lnFor,5]
          INSERT INTO iniFileCursor VALUES (m.lcPath+laFiles[m.lnFor,1])
       ENDIF
   NEXT
RETURN []

Keep in mind VFP limitations.

Borislav Borissov
 
thank a lot bborissov! it worked just the way I wanted it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top