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!