To delete gunziped file
3 ビュー (過去 30 日間)
古いコメントを表示
I am using gunzip to get the unzipped file from .gz file. I need that I get data from the unzipped file and don't get a copy of unzipped file. This is because unzipped file take a lot of space and I have 1000s of such file. i.e. I want to delete the unzipped file as soon as I get required data from it. OR Is there any way to get only required data from .gz file.
Thanks in advance Pooja
2 件のコメント
Stephen23
2014 年 9 月 2 日
But it is not clear what you are actually trying to do. Are you doing this in a loop? In what form is your list of filenames? Do you generate the filenames on the fly? Where are the files located?
We need to know a bit more about what you are doing, in order to have an idea of how to solve your problem.
Please read this advice on how to write a question that will make it easier for people to help you, then edit your question to provide a minimum working example of your code.
採用された回答
Guillaume
2014 年 9 月 2 日
You need to close the file before deleting it. Write
fclose(file);
before
delete(file);
2 件のコメント
Stephen23
2014 年 9 月 2 日
編集済み: Stephen23
2014 年 9 月 2 日
It is a good idea to keep fopen and fclose calls very close to each other, to avoid eaxctly this kind of problem: basically as soon as you write fopen you should write the following fclose too. And keep only the bare minimum amount of code in between, usually reading/writing whatever data is required.
Note that fclose('all') could cause problems if this function is called from another function that has and requires an open file...
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で JSON Format についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!