create new folders by mkdir()
15 views (last 30 days)
Show older comments
i want to create new folders by mkdir() and giving(naming) it numbers sequentially folder1, folder2 .. where no repetead and how to check if folder name found skip and give next number as name for new folder .. please help ,, this part of my project and i havnt time ..
0 Comments
Accepted Answer
the cyclist
on 15 Dec 2016
Edited: the cyclist
on 15 Dec 2016
MAX_FOLDER_NUMBER = 10;
FOLDER_ROOT_NAME = 'folder';
for n = 1:MAX_FOLDER_NUMBER
folder_name = [FOLDER_ROOT_NAME,sprintf('%d',n)];
if not(exist(folder_name,'dir'))
mkdir(folder_name)
end
end
I tried to be very explicit about what each step is about. Also, this code checks whether the folder exists, but I don't actually think that is necessary. I don't think mkdir does anything if you try to create a directory that already exists, so you could just do
MAX_FOLDER_NUMBER = 10;
FOLDER_ROOT_NAME = 'folder';
for n = 1:MAX_FOLDER_NUMBER
mkdir([FOLDER_ROOT_NAME,sprintf('%d',n)])
end
or just
for n = 1:10
mkdir(['folder',sprintf('%d',n)])
end
if you don't want my parameterization.
3 Comments
the cyclist
on 15 Dec 2016
I'm not quite sure what you mean. I suggest you open a new, detailed question related to the GUI, because that is quite different from this topic.
More Answers (1)
kousar majeed
on 12 Jun 2019
i just want to create folder and name it faces
4 Comments
the cyclist
on 16 Jun 2019
Your code works fine for me, from a fresh start of MATLAB R2018b.
Are you certain that your code makes it to that line? For example, do you see the output of the line
disp(progIndication);
?
Are you sure you are looking for the directory Faces in the correct place -- the workspace at the moment this line runs? Also, are you looking for faces instead of Faces (case-sensitive)?
kousar majeed
on 16 Jun 2019
i download a video from internet which is 6 to 7 min and there are 7143 images are there.
i made one folder which is frame and second folder which is faces
now i need to upload or with the help of move command to load image from frame folder with the help of GUI and show the image extract the image and crop is and save it in face folder?
need to do the above task to load image in to GUI nad extract the image
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!