Unzip file on small drive

windows 7zip

I have a zip file that contains many files. Each file in the zip file is about 100MB, and is compressed about 10% (IE it is about 90MB in the zip file). The whole zip file is 20GB, and I'm trying to unzip it onto a drive that has only 30GB free.

On Windows 7, how can I unzip a zip file on my laptop's harddrive that doesn't have enough space for both the zipped and unzipped copies of the file?

IE can I tell windows to remove stuff from the zip file as it is uncompressed?

Best Answer

Sane(-oid) Method

If you had a big enough flash drive (or writable network location, like another CIFS-capable computer on the network), you could extract one file at a time from the archive, then delete the file from the archive, using the (~20GB free) "other space" as the temporary/scratch location. Every archiving utility I've ever worked with can specify an alternate temporary location.

This example script uses 7-zip (as well as grep and sed):

@ECHO OFF
SETLOCAL

SET ARCHIVE=temp.zip
SET SCRATCH_PATH=D:\temp
SET DEST_DIR=%~dp0\extracted

FOR /F "delims=*" %%f IN ('7z.exe l "%ARCHIVE%" -slt ^| grep -B1 "Folder = -" ^| grep "Path = " ^| sed "s/Path = //"') DO (
    @ECHO.
    @ECHO %%~f
    7z.exe x -y -o"%DEST_DIR%" -w"%SCRATCH_DIR%" "%ARCHIVE%" "%%~f" >NUL
    7z.exe d -w"%SCRATCH_DIR%" "%ARCHIVE%" "%%~f" >NUL
    FOR %%g IN (%ARCHIVE%) DO @ECHO   %ARCHIVE%: %%~zg
)

It is functionally correct, though I did not attempt to create a file too big to extract on my computer just to test it.

Crazy Method

You could also temporarily compress some files on the hard drive that you know you won't need during the extraction process (like, say Office) to free up just enough space to extract the files, then reverse the process once extraction is complete.