May 1, 2012 at 8:38 am
Hi,
I trying to carry out some basic file manipualtion within a Script Task.
I have 2 existing files Header.Txt and Footer.txt and I would like to append them to a new file
So the steps are -
1 – Create a new file dynamically Newfile.txt – I've chieved this via System.IO.File.Create
2 – Append Header.txt to NewFile.txt – How?
3 – Append Footer.txt to NewFile.txt – How?
So how can I achieve Steps 2 and 3? Can the be acheived via System.IO? If so how, or maybe there's an easier way of achieving this?
Thanks in advance
May 1, 2012 at 8:41 am
Are you appending text files to each other? Or something else?
With text files, in C#, there's a File object with an AppendText method, if I'm not mistaken.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
May 1, 2012 at 8:48 am
kevin.mitchell (5/1/2012)
Hi,I trying to carry out some basic file manipualtion within a Script Task.
I have 2 existing files Header.Txt and Footer.txt and I would like to append them to a new file
So the steps are -
1 – Create a new file dynamically Newfile.txt – I've chieved this via System.IO.File.Create
2 – Append Header.txt to NewFile.txt – How?
3 – Append Footer.txt to NewFile.txt – How?
So how can I achieve Steps 2 and 3? Can the be acheived via System.IO? If so how, or maybe there's an easier way of achieving this?
Thanks in advance
I'd go low-tech.
Create an Execute Process task and use the DOS Copy command:
Copy Header.txt + Footer.txt Newfile.txt
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
May 1, 2012 at 8:55 am
Hi thanks.
I had noticed the AppendText method. However, I've v little knowledge of the VB and therefore was unable to get it working.
What I am a looking for is an example of the syntax. In time I will need to append more data in between the 'Header' and 'Footer'.
However, If I can get the basics of appending one file to another I think I should be able to work the rest out.
Thanks in advance.
May 1, 2012 at 8:58 am
Hi thanks.
My colleague suggested that solution.
However, over time I will need to append further data in between in between 'header' and 'footer'.
Therefore, i thought it might be more flexible if I achieved the file appends within a script task.
Thanks,
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply