Hw to use file name from for each

I need to get the file name EX: abc_20240930_eyfyj.txt.
I am able to filter that out and getting in for each activity. Now, I want to copy that file and move to other format. How Should I able to get that and copy with rename ?

EX: .txt to .csv with current date.

Hello @Pal_Patel

For the filename, you can refer to the current date using this:
System.DateTime.Now.ToString(“yyyyMMMdd”)

See here for more about Datetime:

To convert your text file into a CSV file, try these steps:

  • Insert a ‘Read Text File’ activities. Save the output as “StringTXT”
  • Insert ‘Generate datatable’ activity and use “StringTXT” as the input and update the delimiter (comma or pipe etc). This will convert the text into a datatable variable. Save the output datatable as “DtResult”
  • Insert a ‘Write CSV’ activity and insert “DtResult” the filepath.

Here is a video tutorial also:

Hopefully this helps,

Cheers

Steve

1 Like

Thanks for looking into it.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.