필터 지우기
필터 지우기

How to use movefile correct?

조회 수: 2 (최근 30일)
Haron Shaker
Haron Shaker 2021년 4월 9일
댓글: Haron Shaker 2021년 4월 9일
Hello guys,
My goal is to delete the .html part of .edf.html-files.
Using the following code, gives the error:
'Error using movefile. Unknown error occurred.
Error in remove_html (line 7)
movefile(oldname,newname);'
files = dir('/Users/haron/Desktop/Work/Haron/aprikose_edfs/*.edf.html');
for ii=1:length(files)
oldname = files(ii).name;
[path,newname,ext] = fileparts(oldname);
movefile(oldname,newname);
end
In the first iteration I get as output for newname: 00008530_s001_t000.edf, which seems to be correct, but it got issues with 'movefile'...
Any ideas?

채택된 답변

Walter Roberson
Walter Roberson 2021년 4월 9일
files = dir('/Users/haron/Desktop/Work/Haron/aprikose_edfs/*.edf.html');
for ii=1:length(files)
oldname = fullfile(files(ii).folder,files(ii).name);
[path,newname,ext] = fileparts(oldname);
movefile(oldname,fullfile(path, newname));
end
  댓글 수: 1
Haron Shaker
Haron Shaker 2021년 4월 9일
It works. Thank you very much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by