How can i open a list of files?

11 Ansichten (letzte 30 Tage)
RADWAN A F ZEYADI
RADWAN A F ZEYADI am 31 Aug. 2022
Beantwortet: Voss am 31 Aug. 2022
Hi,
i am trying to convert some files by GUI from extension to another and i would like to have the converted file with same name of the original file for a list of files in the same directory?
any suggestions please,thanks in advance.

Antworten (1)

Voss
Voss am 31 Aug. 2022
folder = 'Path\to\your\directory';
old_ext = '.txt'; % original extension
new_ext = '.dat'; % new extension
old_files = dir(fullfile(folder,['*' old_ext])); % files with extension old_ext in folder
old_names = fullfile(folder,{old_files.name}); % full-path names of those files
new_names = regexprep(old_names,[old_ext '$'],new_ext); % new file names with extension new_ext

Kategorien

Mehr zu Dialog Boxes finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by