How to Unzip Files in subfolder and delete particular files

1 vue (au cours des 30 derniers jours)
Oktavian Jason
Oktavian Jason le 3 Mar 2020
Hello,
I want to create a unzip code that unzips zip in subfolders too
Example : I have this folder A, inside folder A is folder B C D. Inside folder B is 1.zip and folder C is 2.zip and so on
I have this following code
uiwait(msgbox('Pick a folder on the next window that will come up.'));
files = fullfile('D:\','Proyekan');
selpath = uigetdir(files);
if selpath == 0
return;
end
projectdir = selpath;
dinfo = dir( fullfile( projectdir, '**', '*.zip') ); %find all .zip underneath the projectdir.
%then
parfor K = 1 : length(dinfo)
unzip(fullfile(dinfo(K).folder,dinfo(K).name),selpath);
end
files = dir(projectdir);
deletedfiles = 0;
for itr = 1:length(files)
if files(itr).bytes<1000000 && ~files(itr).isdir
files.name
delete(fullfile(files(itr).folder, files(itr).name))
deletedfiles=deletedfiles+1;
end
end
deletedfiles
The problem is, when I run the code, The extracted files will be in the A folder while I want it to be inside the B, C, D folder.
Any idea how to fix this?
  2 commentaires
Oktavian Jason
Oktavian Jason le 3 Mar 2020
okay, I already edited it

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by