Create multiple copies of one file in multiple directories with different names
16 views (last 30 days)
Rounak Saha Niloy on 28 Sep 2022
I want to create multiple folders. Let's say, the names of folders are- Folder 1, Folder 2, Folder 3 and so on.
In each folder, I would like to copy file "A.txt" and rename the file to "A_1.txt", "A_2.txt", "A_3.txt" and so on. How can I do that?
Fabio Freschi on 28 Sep 2022
Note: the file A.txt must be in the current folder
N = 10;
dirName = 'Folder';
fileName = 'A';
for i = 1:N
% create directory
% copy file