Check free disk space before extraction
Posted: June 1st, 2008, 12:02 am
It would be cool if SABnzbd checked available free disk space on the target before attempting extraction, and would not auto-extract if the check fails. To do this 'properly' would require inspecting the archive to determine what the unpacked size will be. I'm not sure if all archive types that are supported have such a feature/option. In that condition/case, I would propose checking to see if there is (size_of_archive + 10%) available space (10% is just a buffer number, it may be that the average packed ratio is higher?).
unrar 'version 3.71 beta1 freeware' on Linux (default on Ubuntu) has the 'list archive' and 'verbosely list archive' options which would provide the unpacked size:
Unfortunately there isn't an easy way to get only the unpacked size as a return value, which means clever text processing (grep/awk/sed) would be needed. This runs the risk of not being portable, especially if a version change causes the output format to change.
Maybe as an initial release we could just do a check for (size_of_archive + 10%) which should cover the majority of tight space situations, then maybe try to refine the feature later down the road.
Thanks!
unrar 'version 3.71 beta1 freeware' on Linux (default on Ubuntu) has the 'list archive' and 'verbosely list archive' options which would provide the unpacked size:
Code: Select all
$ unrar l SABnzbd-0.4.0Beta5.rar
UNRAR 3.71 beta 1 freeware Copyright (c) 1993-2007 Alexander Roshal
Archive SABnzbd-0.4.0Beta5.rar
Name Size Packed Ratio Date Time Attr CRC Meth Ver
-------------------------------------------------------------------------------
SABnzbd-0.4.0Beta5-src.tar.gz 722079 723545 100% 12-05-08 11:00 -rw-r--r-- A5C50809 m3e 2.9
-------------------------------------------------------------------------------
1 722079 723545 100%
Maybe as an initial release we could just do a check for (size_of_archive + 10%) which should cover the majority of tight space situations, then maybe try to refine the feature later down the road.
Thanks!