Information générale
Catégorie:
Codage, syntaxe et commandes
To find a file you may use Filer.dll foxpro component library:
pDrive="c:\"
lcFlFnd=file_name &&like 'filer.dll'
oMyFiler = CREATEOBJECT('Filer.FileUtil')
WITH oMyFiler
.SearchPath = pDrive
.FileExpression = lcFlFnd
.SubFolder=1 &&search subfolders
wait wind nowa "Searching "+pDrive
.Find(0) && Search, discard last collection
FOR nFileCount = 1 TO .Files.Count
? .Files.Item(nFileCount).path, " ", ;
.Files.Item(nFileCount).nAME
* .Files.Item(nFileCount).Edit && Open files
ENDFOR
ENDWITH
RELEASE oMyFiler
>I've been asked to add a routine in an existing application that searches for a file on the user's machine, then edit that file if it is found. It happens to be an ini file.
>
>I know that locfile() finds a file, but only searches in the paths set in set path. How can I search for a file if I don't know what subdirectory it is located in on the user's machine? Also, what if there might be multiple occurances of the file on the machine? How can I find all of them?
>
>Once located, how do I edit the file within my program. It's a very specific edit on one line of the file. If I use at() or atc() how do I specify the string that I'm searching in?
>
>Thanks.
>
>Judy Scofield
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement