how to unzip files using loop?

7 ビュー (過去 30 日間)
sandy
sandy 2013 年 7 月 31 日
コメント済み: rui gao 2019 年 7 月 15 日
i have 1000 .zip files in single folder. i need to unzip all these and store in new folder using loop statement r any in matlab..help me with this..i don't want to waste time by doing unzipping manually

採用された回答

Andreas Goser
Andreas Goser 2013 年 7 月 31 日
You could help others helping yourself by providing information of what you already have tried. Right now I only can say use the commands DIR, FOR and UNZIP and you are done.

その他の回答 (1 件)

David Sanchez
David Sanchez 2013 年 7 月 31 日
zip_files = dir('*.zip');
for k = 1:numel(zip_files)
unzip(zip_files(k).name,'output_directory_here');
end
  3 件のコメント
Andreas Goser
Andreas Goser 2013 年 7 月 31 日
Voting for David :-) as he provided more value
rui gao
rui gao 2019 年 7 月 15 日
Hi David,
I meet a problem when I unzip my '*.zip' files through the way you mentioned.
My original '*.zip' files contain '*.jpg' files, and once I use your code to unzip a list of '*.zip' files, it shows:
Unable to write file "xxx.jpg".
The entry may be password-protected or encrypted.'
Could you please give me some hints? Many thanks.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by