Hi I have 22 folders, each containing data named 00001.gen to 01460.gen. I need to combin those in to a single folder and name the consecutively, meaning 00001.gen to 32120.gen. Any one out there who can help me?

댓글 수: 2

Matt J
Matt J 2021년 4월 6일
편집: Matt J 2021년 4월 6일
What decides the order in which the 22 folders are concatenated?
The 22 folders represent data from 22 consecutive years.

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

 채택된 답변

Jan
Jan 2021년 4월 6일

0 개 추천

Do the 22 folders have a common base folder? If so:
SrcFolder = 'C:\Your\Base\Folder\'; % Parent folder of the 22 folders
DestFolder = 'C:\Your\Destination\Folder\';
if ~isfolder(DestFolder)
mkdir(DestFolder);
end
List = dir(fullfile(, '**', '*.gen');
for iFile = 1:numel(List)
Src = fullfile(List(iFile).folder, List(iFile).name);
Dest = fullfile(DestFolder, sprintf('%05d.gen', iFile));
copyfile(Src, Dest);
end

댓글 수: 1

Yest they have a common base folder. I'll try your code. Thanks for your help.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB Coder에 대해 자세히 알아보기

태그

질문:

2021년 4월 6일

댓글:

2021년 4월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by