Convert all .txt files in a folder to .csv

PaolaAG
PaolaAG
Altair Employee
edited September 2022 in Community Q&A

Hello!

I have multiple .txt files in a folder and I want to convert them all to .csv. I am trying this way but it didn't work, thank you!

image

Tagged:

Best Answer

  • João Marabisa
    João Marabisa
    Altair Employee
    edited September 2022 Answer ✓

    Hi Paola,

    Please give a try with the script below for your loop:

    for id = 1:numel(FileList)      [~, f,ext] = fileparts(FileList(id).name);     rename = strcat(f,'.csv') ;      movefile(FileList(id).name, rename);  end

Answers

  • João Marabisa
    João Marabisa
    Altair Employee
    edited September 2022 Answer ✓

    Hi Paola,

    Please give a try with the script below for your loop:

    for id = 1:numel(FileList)      [~, f,ext] = fileparts(FileList(id).name);     rename = strcat(f,'.csv') ;      movefile(FileList(id).name, rename);  end
  • PaolaAG
    PaolaAG
    Altair Employee
    edited September 2022

    It works! Thank you :)