free .asp script to find & replace

Results 1 to 2 of 2

Thread: free .asp script to find & replace

  1. #1
    Join Date
    Dec 1969

    Default free .asp script to find & replace

    Hi i m in the middle of a big crisis. I need a .asp script whic h can find a given word let&#039;s say ("hello") in all the files of a folder and then replace all the ("hello") from all the files of the folder to let&#039;s say ("welcome") . So here it goes i have 200 .asp files in one folder of my c drive where instad of writing ("welcome") i have written ("hello") . so now i need to a .asp file where i define the path of the folder then it takes every file of the folder and then reads each file at one time and then find a string called ("hello") and now it replaces this ("hello") with another word we have specified called ("welcome") . Really is this too much to ask for u guy&#039;s I am a fresher only had 11day&#039;s with .asp but if u can email me the script to will be a life saver for me. or i can keep messing around with my head and then try to find a solution. now i dont know too much but i m sure as much as 11 days have taught me it should be apx 10 lines of code ... come one i had been banging my head on the wall for this mall code ..i m learning from the book and i have no collegues who can help me pleeez send me this code. as i had posted this request before and people started asking money for it. oops i admit my fault i would like some one to help me with this for free you can post the script on this board here so other&#039;s can also get advantage of it.<BR>warm regards <BR>savita

  2. #2
    Vijaya Seshan Guest

    Default RE: free .asp script to find & replace

    I have not tried this out, but you can do the following:<BR>You can use the filessystem object to read the files from the folder. You can specify the starting folder and then iterate through the files collection and open one file at a time. Open these files in read/write mode. Now using the ReadAll method of the filesytemobject(FSO), you can read the contents of the file in a string. Now use the Replace() function to replace all occurance of "hello" with "welcome". Now again write this new string into the file. Repeat the same process for all the files. Hope this helps. Incase you have any more doubt you can post another message.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts