MATLAB Answers

save single video in single folder.. having 200 videos in a folder

1 view (last 30 days)
Irfan Hussain
Irfan Hussain on 20 Mar 2020
Commented: Irfan Hussain on 25 Mar 2020
hello all, i have 200 videos in a folder.. i want to send one video to one new folder..
means want to get 200 new folders with different names which having single video in each..
required code
thanks

  0 Comments

Sign in to comment.

Answers (1)

Ameer Hamza
Ameer Hamza on 20 Mar 2020
Edited: Ameer Hamza on 20 Mar 2020
This code will work for all the video files with extension .mp4. If the extension is something else, then change the first line.
files = dir('*.mp4');
for i=1:numel(files)
current_path = fullfile(files(i).folder, files(i).name);
new_folder = fullfile(files(i).folder, files(i).name(1:end-4));
new_path = fullfile(files(i).folder, files(i).name(1:end-4), files(i).name);
mkdir(new_folder);
movefile(current_path, new_path, 'f')
end

  10 Comments

Show 7 older comments
Irfan Hussain
Irfan Hussain on 21 Mar 2020
Videos folder 2... rest of 3 folders having also differents names
Irfan Hussain
Irfan Hussain on 21 Mar 2020
first video form folder 1 and first video of folder 2 (the output like that)

Sign in to comment.


Translated by