7zip 7za.exe - cannot use absolute pathnames

blue piranha picture blue piranha · Nov 26, 2013 · Viewed 16.6k times · Source

Just curious to know if anyone has tried extracting a zip file using 7-zip's 7za.exe to a different location

 7za.exe x sample.zip c:\Temp

gives an error

 Cannot use absolute pathnames for this command

Answer

Leptonator picture Leptonator · Nov 26, 2013

You should be able to do this with (using DOS/Windows command line):

7za.exe -y x D:\somefolder\sample.zip -oc:\Temp

you are missing a couple switches

For the *NIX (this is from LINUX Mint) folks, you would do something like:

7z -y x ~/Downloads/sample.zip -o~/Work

Where:

  • -y assume Yes on all queries
  • x eXtract files with full paths
  • -o set Output directory
<Switches>
  (...)
 -o{Directory}: set Output directory`

Let's take this to another level..

Let's say you are processing a number of reports that have to be processed and have to be sent to 300-500 customers.

But, let's only grab files that are from a certain day or even a couple days..

7-zip can handle this too!!

7za.exe -y x D:\somefolder\sample.zip -oc:\Temp 20150225* -r
7za.exe -y x D:\somefolder\sample.zip -oc:\Temp 20150224* -r
7za.exe -y x D:\somefolder\sample.zip -oc:\Temp 20150223* -r

So, if your archive has say the last 30 days, you can extract just 1, 2, or 3 days without having extract the whole archive.

IMPORTANT NOTE: If you put a space after -o, you may get a Error: Incorrect command line.