% 文件另存为容易失效,本程序采用复制的方法
%
rootpath='H:\以前的数据文件夹\';
newpath='C:\Users\NO1\Desktop\新的数据文件夹\';
files=dir(fullfile([rootpath,'*ULT.csv']));
lens=length(files); %依次循环
for i=1:lens
file=dir([rootpath,files(i).name]);
oldname=file.name;
newname=[files(i).name(1:end-4),'-2.csv']; %重命名
copyfile([rootpath oldname],[newpath,newname]);%复制到“新的的数据”文件夹中
end