Unable to unzip and untar a .tar.gz file

19 ビュー (過去 30 日間)
Tianchu Lu
Tianchu Lu 2022 年 7 月 11 日
回答済み: Tianchu Lu 2022 年 7 月 11 日
I have downloaded a .tar.gz file from the internet and I have written a code to unzip and untar the file. But there is an error keep popping up where it says the path to the file is not in a GZIP format, could anybody offer any other alternative as to how I would be able to untar and unzip the file.
myFile= "F:\podTc2_nrt_2022_001.tar.gz";
tarFile=gunzip(myFile);
untar(tarFile{1},"podtc2_data\");
the above is the code that was written, but i get an error using matlab.io.internal.archive.core.builtin.uncompressgz, where the file thats specified is not in a GZIP format.
Many Thanks
  2 件のコメント
Benjamin Thompson
Benjamin Thompson 2022 年 7 月 11 日
Can you try this with some other compression tool such as Winzip or 7-zip?
Tianchu Lu
Tianchu Lu 2022 年 7 月 11 日
it didnt work out, but the strange things is that the following code has successfully unzip and untarred a similar file, but it stopped working, to which i am very confused about. Thanks, Regards

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

採用された回答

Tianchu Lu
Tianchu Lu 2022 年 7 月 11 日
Files=untar("F:\podtc2_data\podTc2_nrt_2022_003.tar.gz",'podTc2_nrt_2022_003');
such method would be sufficient
url_https='https://data.cosmic.ucar.edu';
dataUrl=strcat(url_https,"/gnss-ro/cosmic2/nrt/level1b/2022/003/podTc2_nrt_2022_003.tar.gz")
dataFile="podTc2_nrt_2022_003.tar.gz";
FileFullPath=websave(dataFile,dataUrl);
Files=untar("F:\podtc2_data\podTc2_nrt_2022_003.tar.gz",'podTc2_nrt_2022_003');

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by