7zip 7za.exe - cannot use absolute pathnames - 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

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.

Related

Imagemagick error using overlapcrop on Window with Cygwin

I am using Imageimagick to crop arieal images in equal sizes.
Searching Google imagemagick tutorials led me to Fred Weinhaus scripts tutorial which I followed. When I am passing the command on bash or cmd based on syntax given in this website (bash /fullpathto/scriptname.sh with arguments /fullpathto/inputimage /fullpathto/outputimage)
I am getting error
$ overlapcrop -s 128 -o 50% -m matrix -M -L \
-R 'F:\bash\top_potsdam_2_10_RGB' 'F:\bash\o.jpg'
error Invalid Parameter - F:\bash\top_potsdam_2_10_RGB
FILE F:\bash\top_potsdam_2_10_RGB DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAS ZERO SIZE
Even if we set the directory in the path, we get the same error:
$ overlapcrop -s 128 -o 50% -m matrix -M -L -R top_potsdam_2_10_RGB.png o.png
--Screenshots of imagemagick --help and convert --help
error I am getting
Windows is useless when it comes to quoting, so maybe try escaping the % sign by adding a second one or a caret (^) in front of it.
Also, try removing the F: from the paths and try putting the files in the current directory in case the slashes are causing errors.
Finally, you may have your PATH set incorrectly so that when the script executes the convert command it finds the Windows utility that converts filesystems to NTFS rather than the ImageMagick utility that converts images.
Try running:
convert /?
and seeing if you get an error/help message from Windows CONVERT.EXE or something from ImageMagick. If you get the Windows one, your PATH is incorrect and you need to put the directory where you installed ImageMagick ahead (in front of) C:\WINDOWS\System32 or wherever Windows CONVERT.EXE lives and restart your Command Prompt window.

7zip produces different output from identical input

I'm using command line 7zip to zip up the contents of a folder (in Windows) thus:
7za a myzip.zip * -tzip -r
I've discovered that running exactly the same command line twice will produce two different ZIP files - they've got the same size but if you run a binary compare (ie fc /b file1.zip file2.zip) they are different. To complicate matters it seems that if you make the two zips in rapid succession then they are the same. But if you do them on different days or separated by a few hours they are not.
I presume that there's a date/time stamp in the ZIP file somewhere but I can't find anything on the 7zip site to confirm that.
Assuming I'm right does anyone know how to suppress the date/time? Or is something else causing the binaries to be different?
7-zip has the switch -m with parameter tc which has value on by default if not specified on command line.
With -mtc=on all 3 dates of a file stored on an NTFS partition are stored in the archive:
the last modification time,
the creation time, and also
the last access time.
See in help of 7-zip the page with title -m (Set compression Method) switch.
The last access time of the files is most likely responsible for the differences between the archive files.
You have to append -mtc=off to avoid storage of the NTFS timestamps in archive file.

Why does 7z create different files?

I'm using 7z command in bash script to create a 7z archive for backup purposes. My script does also check if this newly created 7z archive exists in my backup folder and if it does, I go and run md5sum to see if content differs. So if the archive file doesn't exits yet or the md5sum differs from the previous I copy it to my backup folder. So I tried a simple example to test the script, but the problem is that I sometimes get different md5sum for the same folder I am compressing. Why is that so? Is there any other reliable way of checking if file content differs? The commands are simple:
SourceFolder="/home/user/Documents/"
for file in $SourceFolder*
do
localfile=${file##*/}
7z a -t7z "$SourceFolder${localfile}.7z" "$file"
md5value=`md5sum "$SourceFolder${localfile}.7z"|cut -d ' ' -f 1`
...copyinf files goes from here on...
The reliable way to check if two different losslessly compressed files have identical contents is to expand their contents and compare those (e.g. using md5sum). Comparing the compressed files is going to end badly sooner or later, regardless of which compression scheme you use.
I've partially solved this. It looks like it matters if you specify full path to the folder you are compressing or not. The resulting file is not the same. .This affects both 7z and tar.I mean like this:
value1=$(tar -c /tmp/at-spi2/|md5sum|cut -d ' ' -f 1)
value2=$(tar -c at-spi2/|md5sum|cut -d ' ' -f 1)
So obviously I'm doing this wrong. Is there a switch for 7z and tar which would remove absolute path?

How can I extract multiple 7z files in folder at once in Ubuntu?

How can I extract about 900 7z files which are all located in the same folder (all have only one file inside) without doing it one by one?
I am using Ubuntu 10.10. All files are located in /home/username/folder1/folder2.
7za -y x "*.7z"
The above code worked for me
for arc in *.7z
do
7zwhatever "$arc"
done
Using parallel is rather convenient way with total progress meter for free ;)
ls *.7z | parallel -j+0 --eta '7z x {} >/dev/null'
7z x "*.7z"
this worked for me in ubuntu
for f in *.7z
do
7zr e "$f" &
done
This will extract all .7z files if they're 7z format to the current directory, without waiting for completion.
Your computer could be owned. You have been warned!
If you wish to extract multiple 7zip archives to folders with the same names in Linux, you can use:
for archive in *.7z; do 7z x -o"`basename \"$archive\" .7z`" "$archive"; done
For example, if you have two 7zip archives a.7z and b.7z, it will create two folders a and b, and uncompress a.7z into folder a and b.7z into folder b.
The above command comes from this answer on superuser by user Vojtech.
You do not need to overcomplicate things. To extract a 7-Zip archive split to multiply parts use the following command:
7z x archive.7zip.0
7-Zip will notice you that you have a multi-volume archive and it unpacks everything.
Probably the simplest approach is below
ls | xargs -n1 7z x
in adition to using a for loop
you can also use find in combination with the exec argument or xargs
The simplest way is unzip '*.zip'.
Make sure you have the ' marks.

Untar multipart tarball on Windows

I have a series of files named filename.part0.tar, filename.part1.tar, … filename.part8.tar.
I guess tar can create multiple volumes when archiving, but I can't seem to find a way to unarchive them on Windows. I've tried to untar them using 7zip (GUI & commandline), WinRAR, tar114 (which doesn't run on 64-bit Windows), WinZip, and ZenTar (a little utility I found).
All programs run through the part0 file, extracting 3 rar files, then quit reporting an error. None of the other part files are recognized as .tar, .rar, .zip, or .gz.
I've tried concatenating them using the DOS copy command, but that doesn't work, possibly because part0 thru part6 and part8 are each 100Mb, while part7 is 53Mb and therefore likely the last part. I've tried several different logical orders for the files in concatenation, but no joy.
Other than installing Linux, finding a live distro, or tracking down the guy who left these files for me, how can I untar these files?
Install 7-zip. Right click on the first tar. In the context menu, go to "7zip -> Extract Here".
Works like a charm, no command-line kung-fu needed:)
EDIT:
I only now noticed that you mention already having tried 7zip. It might have balked if you tried to "open" the tar by going "open with" -> 7zip - Their command-line for opening files is a little unorthodox, so you have to associate via 7zip instead of via the file association system built-in to windows. If you try the right click -> "7-zip" -> "extract here", though, that should work- I tested the solution myself (albeit on a 32-bit Windows box- Don't have a 64 available)
1) download gzip http://www.gzip.org/ for windows and unpack it
2) gzip -c filename.part0.tar > foo.gz
gzip -c filename.part1.tar >> foo.gz
...
gzip -c filename.part8.tar >> foo.gz
3) unpack foo.gz
worked for me
As above, I had the same issue and ran into this old thread. For me it was a severe case of RTFM when installing a Siebel VM . These instructions were straight from the manual:
cat \
OVM_EL5U3_X86_ORACLE11G_SIEBEL811ENU_SIA21111_PVM.tgz.1of3 \
OVM_EL5U3_X86_ORACLE11G_SIEBEL811ENU_SIA21111_PVM.tgz.2of3 \
OVM_EL5U3_X86_ORACLE11G_SIEBEL811ENU_SIA21111_PVM.tgz.3of3 \
| tar xzf –
Worked for me!
The tar -M switch should it for you on windows (I'm using tar.exe).
tar --help says:
-M, --multi-volume create/list/extract multi-volume archive
I found this thread because I had the same problem with these files. Yes, the same exact files you have. Here's the correct order: 042358617 (i.e. start with part0, then part4, etc.)
Concatenate in that order and you'll get a tarball you can unarchive. (I'm not on Windows, so I can't advise on what app to use.) Note that of the 19 items contained therein, 3 are zip files that some unarchive utilities will report as being corrupted. Other apps will allow you to extract 99% of their contents. Again, I'm not on Windows, so you'll have to experiment for yourself.
Enjoy! ;)
This works well for me with multivolume tar archives (numbered .tar.1, .tar.2 and so on) and even allows to --list or --get specific folders or files in them:
#!/bin/bash
TAR=/usr/bin/tar
ARCHIVE=bkup-01Jun
RPATH=home/user
RDEST=restore/
EXCLUDE=.*
mkdir -p $RDEST
$TAR vf $ARCHIVE.tar.1 -F 'echo '$ARCHIVE'.tar.${TAR_VOLUME} >&${TAR_FD}' -C $RDEST --get $RPATH --exclude "$EXCLUDE"
Copy to a script file, then just change the parameters:
TAR=location of tar binary
ARCHIVE=Archive base name (without .tar.multivolumenumber)
RPATH=path to restore (leave empty for full restore)
RDEST=restore destination folder (relative or absolute path)
EXCLUDE=files to exclude (with pattern matching)
Interesting thing for me is you really DON'T use the -M option, as this would only ask you questions (insert next volume etc.)
Hello perhaps would help.
I had the same problems ...
a save on my web site made automaticaly in Centos at 4 am create multiple file in multivolume tar format (saveblabla.tar, saveblabla.tar1.tar, saveblabla.tar2.tar,etc..)
after downloading this file on my PC (windows) i can't extract them with both windows cmd or 7zip (unknow error).
I thirst binary copy file to reassemble tar files. (above in that thread)
copy /b file1+file2+file3 destination
after that, 7zip worked !!! Thanks for you help

Resources