freedomphy

起因:要从服务器上下载图片,图片在服务器上是一个文件夹,但我想按照年月日分开来

于是:首先把图下到一个文件夹里

%% move file 
sourcedir = \'F:\coffee\T6049all\T6049\201809\0906\';
destinDir = \'F:\coffee\T6049all\T6049\';
imagelist = dir(sourcedir); % 从第三个开始才是图片
imgLength = length(imagelist); % 图片数+2
for i = 3: imgLength
    name = imagelist(i).name;
    monthdir = name(:,10:15); %年月
    datedir = name(:,14:17); % 月日
    imagepath = fullfile(sourcedir, name); %图片路径,移动图片路径
    finDesDir = fullfile(destinDir,monthdir,datedir);
    movefile(imagepath,finDesDir); %movefile 使用需加括号
end

  成功~~

分类:

技术点:

相关文章:

  • 2022-01-11
  • 2021-12-26
  • 2021-04-01
  • 2021-09-29
  • 2021-12-31
  • 2021-05-06
  • 2021-12-16
  • 2021-04-10
猜你喜欢
  • 2021-12-05
  • 2021-10-12
  • 2022-12-23
  • 2021-12-04
  • 2021-04-05
  • 2022-12-23
  • 2021-12-31
相关资源
相似解决方案