gzip keeps original file
8 views (last 30 days)
Show older comments
I just noticed the default behavior of the Matlab gzip command is to keep the original uncompressed file. Is there a way to have it behave more like the unix gzip(1) command, that is, remove the original file after commpressing?
0 Comments
Answers (5)
Tom
on 7 Apr 2011
3 Comments
Jan
on 8 Apr 2011
@Tom: If you are in fear, that the original files are deleted by accident, use RECYCLE to enable the usage of the recycle bin for DELETE.
Walter Roberson
on 8 Apr 2011
One of the things I would want to check on is whether you can be guaranteed that by the time the write stream close returns, that the file has been completely dispatched to the operating system to write and that there was enough disk space to write. Better, that the write did succeed (e.g., no bad blocks.) Even then if your files happened to be over NFS I would want stricter conditions, as I have observed in the past that the local system believed (with good reason) that the file had been completely written, but that there were errors on the server side.
Andres
on 29 Jun 2011
Hello guys, did someone find a solution for the check? I am currently searching for a way to test the integrity of zipped files via Matlab-GZIP.
0 Comments
Daniel Shub
on 29 Jun 2011
If you like the unix gzip, why not just use it directly ...
system(['gzip ', FileNameStr])
0 Comments
Tom K
on 30 Jun 2011
Thanks for everyone's comments. My original question came up in the context of a program I'm writing that does a file gunzip, reads the file, then gzip's file again. I use the fact that Matlab's gunzip also keeps the original compressed file, and write the uncompressed file to a temp dir and read it into Matlab from there. My original file, gzipped in unix, remains as it was, so no need for checking, and no extra clutter in the original dir. Good enough for me.
Sounds like if you want a gzip with consistency checks, the unix gzip is the way to go.
0 Comments
See Also
Categories
Find more on File Compression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!