Script task inside a For Each loop - writing to a file

  • My script task is inside a for each loop. I want the script task to write some dynamic string to one file only for all iterations. After every iteration, the file should get appended, not overwritten with the current value of the dynamic string. Its like a logging "tool".

    How do I do this ?

    Here is the script which is inside my for each loop -

    String text = "My text here";

    String path = @"C:\Data\TextFiles\logFile.txt";

    StreamWriter file = new StreamWriter(path, true);

    file.WriteLine(text);

    file.Close();

  • See here.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply