how to fetch files from each sub directory?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
hi ..example.if i have a folder name as 'DATA',inside this subfolder namely 2000 to 2013(year) are ther..in this each folder(01 TO 12,say month),in each month folder,o1 to 31 days folder are ther,inside each days folder many .zip files are ther..i need to fetch all the .zip files inside main folder('DATA'),and extract them to a separate folder.is it possible? any defined function? i couldnt do with below code..help need
for kk=1997:2013
if exist(folder,'dir')
for ll=1:12
if exist(folder,'dir')
for mm=1:31
currfold=[folders(ii) '\*.zip'];
currfiles=dir(currfold);
%now do something with these files
for jj=1:length(currfiles)
unzip([folders(ii) '\' currfiles(jj).name],outputfolder);
end
end
end
end
end
end
0 comentarios
Respuestas (1)
David Sanchez
el 16 de Sept. de 2013
Use the dir2 function. With it, you can fetch files recursively.
1 comentario
Ver también
Categorías
Más información sobre Scope Variables and Generate Names en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!