Naming new directories sequentially
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Nadeau Hahne
il 20 Mag 2021
Commentato: Nadeau Hahne
il 20 Mag 2021
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
0 Commenti
Risposta accettata
Stephen23
il 20 Mag 2021
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
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Search Path in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!