Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A Fox command dos's DIR MYFILE.TXT >FILELIST.TXT /S
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00043406
Message ID:
00043459
Vues:
49
> I need a VFP command which will dump the results of a search command > into a > file. My program needs to look for any file meeting the DOS criteria > XFER*.DBF. These files could be in any subdirectory. THE DOS command > to > do it would be: > > DIR XFER*.DBF >FILELIST.TXT /S I'll let you test & debug this code for me (I haven't): declare laFiles(1) laFiles = "" m.lnFound = FindFiles("laFiles","XFER*.DBF") wait window "Found "+alltrim(str(m.lnFound))+" files matching XFER*.DBF" procedure FindFiles LParameter lcArray, lcFileSpec, lcDirectory * Validate the parameters if type("m.lcDirectory") # "C" m.lcDirectory = "" endif if (not empty(m.lcDirectory)) and ; right(m.lcDirectory) # ":" and ; right(m.lcDirectory) # "\" m.lcDirectory = m.lcDirectory + "\" endif if type("m.lcFileSpec") # "C" or ; empty(m.lcFileSpec) m.lcFileSpec = "" endif if type("m.lcArray") # "C" or ; empty(m.lcArray) or ; type(m.lcArray+"(1,1)") # "C" return endif * Add the current directory private lnFound, laThisDir, lcFile m.lnFound = adir(m.lcDirectory+m.lcFileSpec,laThisDir) if m.lnFound # 0 for m.lnFound = 1 to alen(laThisDir,1) if empty(&lcArray.(1,1)) declare &lcArray(alen(&lcArray)+1) endif &lcArray(alen(&lcArray)) = m.lcDirectory + laThisDir(m.lnFound,1) endfor endif * Search the SubDirectories m.lnFound = adir(m.lcDirectory+"*.*",laThisDir,"D") if m.lnFound # 0 =FindFiles( (m.lcArray), (m.lcFileSpec), (laThisDir(m.lnFound,1)) ) endif * Return the results if empty(&lcArray.(1,1)) return 0 else return alen(&lcArray) endif
Paul Russell
EMail: prussell@fox.nstn.ca
Phone: (902) 499-5043
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform