简体   繁体   中英

How to edit a portion of a xml file using SSIS?

I have a xml file.

in the file there are some file name like a.txt,b.txt.

Now everytime it will be changed and the final filename will be like this:

file name =a_Currentdate_V1.txt

same goes for B.txt

How can I do this using SSIS? what should i write in the script file?

You can do this by using script task, pass the directory path to foreach container to iterate over file, write script task in foreach container which will read all data from xml/text file, modify it and then write the modified data to the file again, refer below code.

string data=System.IO.File.ReadAllText("path/to/the/file");

  //data= Manipulate data here
  //.......
  //.......

System.IO.File.WriteAllText("path/to/the/file",data);

that's it and you can now move or copy file anywhere you want using File System Task

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM