Hello,
I am trying to figure out how to make new folders with a prefix and sequentially number them. I would like them to all contain the same sub directories:
Prefix_001
Subdirectory A
Subdirectory B
Prefix_002
Subdirectory A
Subdirectory B
Prefix_003
Subdirectory A
Subdirectory B

 채택된 답변

Stephen23
Stephen23 2021년 5월 20일

0 개 추천

N = number of directories
P = 'absolute/relative path to the parent directory';
for k = 1:N
D = sprintf('Prefix_%03d',k);
mkdir(fullfile(P,D))
mkdir(fullfile(P,D,'Subdirectory A'))
mkdir(fullfile(P,D,'Subdirectory B'))
end

댓글 수: 1

Nadeau Hahne
Nadeau Hahne 2021년 5월 20일
Perfect, thank you, I am new to scripting, this was super helpful!

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

추가 답변 (0개)

카테고리

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

제품

릴리스

R2020b

질문:

2021년 5월 20일

댓글:

2021년 5월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by