Filesystem object

Results 1 to 3 of 3

Thread: Filesystem object

  1. #1
    Suresh Guest

    Default Filesystem object

    Hi,<BR><BR>I&#039m writing a ASP script using filesystem object. I&#039m trying to append the text at a particular location of the file. Is there any way I can find the location so that the text which I&#039m appending will be written at that location.Hope it is clear. Appreciate your help.<BR><BR>Thanks,<BR>suresh.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Filesystem object

    Sure - use the Line property and SkipLine method of the FileSystem object. Line will return the line #, so read in the file until conditions are met and return the number. Now you know the location you want to append to.<BR>

  3. #3
    subzer0 Guest

    Default Alternative...

    You could use bookmarks in your file and replace them with what you need.<BR><BR>e.g.<BR><BR>File that gets corrected -file1:<BR>blah, blah, blah<BR>[**BOOKMARK**]<BR>blah, blah, blah<BR><BR>ASP Code:<BR>Set objFileSys=Server.CreateObject("Scripting.FileSyst emObject")<BR>Set objFile1=objFileSys.OpenTextFile("file1")<BR>strFi le1Contents=objFile1.ReadAll<BR><BR>objFile1.Close <BR>Set objFile1=Nothing<BR><BR>strFile1Corrected=Replace( strFile1Contents, "[**BOOKMARK**]", strCorrection)<BR><BR>Set objFile1=objFileSys.CreateTextFile("file1_correcte d")<BR>objFile1.Write strFileCorrected<BR><BR>objFile1.Close etc. etc.<BR>Hope it helps.

Posting Permissions

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