Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Search and replace
Message
De
23/01/2004 08:34:40
 
 
À
23/01/2004 08:13:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Divers
Thread ID:
00869816
Message ID:
00869824
Vues:
12
>I need to replace the word xxx for yyy for every file contained in a directory tree. What can I do? There are hundreds of words.
>
>TIA,

Hi Pablo;

On the following procedure you must only have care about files with some "danger" extension (as .EXE for instance)
cwpath              = "\\machine\c\myfolder\mysub"
cwoldtext           = "xxx"
cwnewtext           = "yyy"
Set defa to (cwpath)
nwtotalfiles        = 0
Dimension awFiles[1]
nwtotalfiles        = ADIR(awFiles,"*.*")
For ix = 1 TO nwtotalfiles
    cwbuff        = filetostr(awFiles[ix,1])
    do  while cwoldtext $ cwbuff
        if  at(cwoldtext, cwbuff) > 0
            cwbuff     = stuff(cwbuff, at(cwoldtext, cwbuff), len(cwoldtext), cwnewtext)
        endif
    Enddo
    =strtofile(cwbuff, awFiles[ix,1])
Endfor
HTH

Claudio
"Now to him who is able to do immeasurably more than all we ask or imagine, according to his power that is at work within us, Ephesians 3:20
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform