Fail to unzip .gz file using 7zip in Matlab
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I have a folder that has multiple gz files and I'd like to unzip the selected file from the folder to unzip. I first select the file and save it under gz_full_path. I havea destination folder called session_folder_path where the extracted file needs to be saved.
The 7 zip exe is already in the path.
When I run the code below, it returns an error 'COMMAND must be a string scalar or character vector'.
When I run the alternate version to extract using 7zip, it retrns an error 'Incorrect command line'.
Any pointers on what is wrong would help. it was working couple of hours ago but it is failing to run now. Unsure why
[gz_file, gz_path] = uigetfile('*.gz', 'Select the session output file', session_folder_path);
gz_full_path = strcat(gz_path, gz_file);
[status,output] = system(['"C:\Program Files\7-zip\7za920\7za.exe" -y x ' '"' gz_full_path '"' ' -o' '"' session_folder_path '"']);
if status
error("There was an error running your command: %s", output);
return;
end
%%%
%Alternate version
unzip_cmd = "7za e" + gz_full_path + " -o" + session_folder_path + "\files -y";
[status,output] = system(unzip_cmd);
if status
error("There was an error running your command: %s", output);
return;
end
0 commentaires
Réponses (1)
Star Strider
le 1 Nov 2022
2 commentaires
Star Strider
le 1 Nov 2022
My pleasure!
That would be difficult, since I don’t know how you set up your system. I’m also not familiar with 7zip.
Voir également
Catégories
En savoir plus sur File Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!