Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

How to access last 5 images from the list of sub folders and save it in some order of folders?

1 visualizzazione (ultimi 30 giorni)
I have a dataset containing multiple subfolders. i will give some description.
Main Folder(Casia)
2-Sub folders (1-NI_Acropped, 2-VL_Acropped)
each have 3 sub folders(1.1- Dark, 1.2-Strong, 1.3-Weak)
each have 80 sub folders(P001, P002, ... P080)
each have 6 sub folders (ANG, DIS, FEA, HAP, SAD SUR).
Q1 I want to make a logic that creates the folders like this:
Main Folder(Casia)
2-Sub folders (1-NI_Acropped, 2-VL_Acropped)
each have 3 sub folders(1.1- Dark, 1.2-Strong, 1.3-Weak)
and discard 80 folder and make 6-sub folder in dark strong and in weak
like for everyone.
Q2 Now Can access last 5 images of every 6 folders of every 80 folders and save it to the created folders in Q1.
See the attach pic for detail. Please Help me to create the logic

Risposte (1)

Akira Agata
Akira Agata il 10 Ott 2018
Regarding your Q1, the following script can copy the 'NI_Acropped' folder structure to 'VL_Acropped' without copying files.
list = dir('./NI_Acropped/**/*');
list = struct2table(list);
idx = ismember(list.name,{'.','..'});
list(idx,:) = [];
for kk = 1:height(list)
if list.isdir(kk)
dirPath = fullfile(...
strrep(list.folder{kk},'NI_Acropped','VL_Acropped'),list.name{kk});
mkdir(dirPath);
end
end
As for your Q2, what do you mean by "last 5 images" ? Is it the last 5 files in file list, sorted by file name, for each subfolder?

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by