How to delete the ending / last characters of files?
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Haron Shaker
am 23 Mär. 2021
Kommentiert: Haron Shaker
am 9 Apr. 2021
Dear all,
I got a list of '...edf.html' files (e.g. 00014654_s001_t000.edf.html).
I want to delete for all files the '.html' part. How can I do it?
Akzeptierte Antwort
Rashed Mohammed
am 26 Mär. 2021
Bearbeitet: Rashed Mohammed
am 26 Mär. 2021
Hi Haron
As suggested by Stephen, you can use fileparts and movefile functions to delete the '.html' part from your filenames. Below is a sample code.
files = dir('*.edf.html');
for ii=1:length(files)
oldname = files(ii).name;
[path,newname,ext] = fileparts(oldname);
movefile(oldname,newname);
end
Hope this helps
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Entering Commands finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!