How to Unzip Files in subfolder and delete particular files

1 visualización (últimos 30 días)
Oktavian Jason
Oktavian Jason el 3 de Mzo. de 2020
Comentada: Oktavian Jason el 3 de Mzo. de 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 comentarios
Oktavian Jason
Oktavian Jason el 3 de Mzo. de 2020
okay, I already edited it

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by