I want to create sub folders

I have 1000 frames in a folder. I want to create 10 sub folders and want to store 100 frames in each sub folder.

3 Comments

I also want to move frames from parent folder to the subfolders
Thanks for your answer. But I want to move first 100 frames in folder 1, and then second 100 frames in folder 2 and so on. Can you please tell me how I can do that?

Sign in to comment.

 Accepted Answer

mkdir('Frames 1 to 100');
mkdir('Frames 101 to 200');
mkdir('Frames 201 to 300');
mkdir('Frames 301 to 400');
mkdir('Frames 401 to 500');
mkdir('Frames 501 to 600');
mkdir('Frames 601 to 700');
mkdir('Frames 701 to 800');
mkdir('Frames 801 to 900');
mkdir('Frames 901 to 1000');

5 Comments

Thanks for your answer. image names are like Img0001.tif, Img0002.tif ...... upto Img1000.tif and my parent folder directory is C:\Users\aftab\Desktop\New folder
Now can you please explain me how I can write a code using mkdir Thanks a lot for your answer.
mkdir('C:\Users\aftab\Desktop\New folder\Frames 1 to 100');
mkdir('C:\Users\aftab\Desktop\New folder\Frames 101 to 200');
mkdir('C:\Users\aftab\Desktop\New folder\Frames 201 to 300');
mkdir('C:\Users\aftab\Desktop\New folder\Frames 301 to 400');
mkdir('C:\Users\aftab\Desktop\New folder\Frames 401 to 500');
mkdir('C:\Users\aftab\Desktop\New folder\Frames 501 to 600');
mkdir('C:\Users\aftab\Desktop\New folder\Frames 601 to 700');
mkdir('C:\Users\aftab\Desktop\New folder\Frames 701 to 800');
mkdir('C:\Users\aftab\Desktop\New folder\Frames 801 to 900');
mkdir('C:\Users\aftab\Desktop\New folder\Frames 901 to 1000');
You can use sprintf() to build up a string if you want. But since there's only 10 of them, it's easiest just to call mkdir 10 times rather than fool with a look and sprintf, as long as you have a known 1000 frames. If the number of frames could be variable, then construct a loop.
Thank you again for your answer. I also want to move the frames. I have 1000 frames. Now first 100 frames should move to the folder 'Frames 1 to 100' , second 100 frames should move to the folder 'Frames 101 to 200'. Can you please tell me how I can do this part?
I am trying to do this to move file. movefile('C:\Users\aftab\Desktop\New folder\ImgA001764.tif','C:\Users\aftab\Desktop\New folder\Frames 1 to 100') but how I can do this for 100 frames.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!