I have a process that is receiving files that come in pairs. One is a ctr file and the other is the data file. The ctr and data file will always have the same name except different extensions. E.g. dfghj.ctl and dfghj.dat
The problem I have is that I receive multiple of these pairs at the same time. The only way to tell which is which is to look into the ctl file. This tells me if the the .dat file related to it is either the report.jsonl file or the delta.jsonl file.
An example of a .ctl is:
<DTSControl>
<Version>1.0</Version>
<AddressType>DTS</AddressType>
<MessageType>Data</MessageType>
<From_DTS>x26OT075</From_DTS>
<To_DTS>x26OT075</To_DTS>
<Subject>ECDS Submission</Subject>
<LocalId>TEST-delta.jsonl</LocalId>
<WorkflowId>SUS_CDS</WorkflowId>
<Encrypted>N</Encrypted>
<Compress>Y</Compress>
</DTSControl>
The bit I need to get to is the LocalId which tells me what type of file the .dat is and therefore which table I need I need to load it to. Once I know which file is which, I then need to pass the associated .dat file name to a variable to populate the source connection.
The only thing I can think of is a script task to load a ctl file, isolate the LocalId and if it is like *-report.jsonl then strip the last three characters of the file and replace ctl with dat and pass that string to the variable but I've no idea how to get to LocalId as I don't work with c#.
Is anyone able to give a pointer as to how to get there? It may not always be the eighth line so I would prefer to tell it to go LocalID which won't change.
Thanks in advance