Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

7zip 7za.exe - cannot use absolute pathnames

Tags:

7zip

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
like image 933
blue piranha Avatar asked Nov 26 '13 18:11

blue piranha


1 Answers

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.

like image 122
Leptonator Avatar answered Oct 06 '22 10:10

Leptonator