Error in unziping files and then deleting files in the zip

2 ビュー (過去 30 日間)
Oktavian Jason
Oktavian Jason 2020 年 2 月 18 日
コメント済み: Stephen23 2020 年 2 月 18 日
Hello,
I have this following code for choosing a folder then deleting some files in specific size
files = fullfile(matlabroot, '\toolbox');
if ~exist(files, 'dir')
files = matlabroot;
end
uiwait(msgbox('Pick a folder on the next window that will come up.'));
selpath = uigetdir(files);
if selpath == 0
return;
end
unzip(selpath)
files = dir(selpath);
deletedfiles = 0;
for itr = 1:length(files)
if files(itr).bytes<200000 && ~files(itr).isdir
files.name
delete(fullfile(files(itr).folder, files(itr).name))
deletedfiles=deletedfiles+1;
end
end
deletedfiles
But i got error in the unziping part.
>> cobacoba
Error using parseUnArchiveInputs (line 76)
ZIPFILENAME "D:\Nenen" is a directory.
Error in unzip (line 55)
[zipFilename, outputDir, url, urlFilename] = parseUnArchiveInputs( ...
Error in cobacoba (line 10)
unzip(selpath)
Any ideas what should I do?

採用された回答

Stephen23
Stephen23 2020 年 2 月 18 日
As its documentation clearly states, unzip's first input argument needs to be the name of a zip file.
selpath is not the name of a zip file.
  4 件のコメント
Oktavian Jason
Oktavian Jason 2020 年 2 月 18 日
okay, so can I get the .zip using uigetfile then unzip it using unzip?
Stephen23
Stephen23 2020 年 2 月 18 日
"okay, so can I get the .zip using uigetfile then unzip it using unzip?"
Yes.

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

その他の回答 (0 件)

カテゴリ

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