What DOS commands do I use to extract a tarball? - windows

A friend sent me a tarball entitled cst-web.tar.gz
I am on a work computer that doesn't allow me to download files so I thought to extract the tarball using the DOS commands. However, when I use any of the DOS commands I found such as
tar xf [filename]
# or
tar -xvzf [filename]
I get the message that the command is 'not recognizable as an internal or external command, operable program or batch file'.
Stuck on what to try next. Any suggestions?

There is nothing built into Windows that can extract a tarball. You will need a third-party program like 7-Zip or WinRAR. If you can't download files, you can't open the tarball.

Related

Winzip command line error and message handling

I'm trying to automatically zip a group of files and move them to a different location.
This is the command i'm using for the script:
<WinzipPath> -a -r -en <Dest&Name>.zip <source>
Problem is that at any given moment one of the files is still being written, and when i try to zip it i get the following message which interrupts my automation:
Any idea on how do I ignore\skip the message via CMD? tried looking in the Winzip's Doc for more flags but couldn't find anything helpful
Another (smaller) issue is that when zipping for the first time after installing I get this message:
Can I skip that as well?
Are you using WinZip or WinZip Command-line Add-on?
You will do much better when scripting to use WZZIP which is installed after installing the command-line Add-on in the WinZip folder. NOTE: You must have WinZip Professional installed first.
http://winzip.com/downcl.html
Better yet, if you have the option to use 7-zip.. Understand if you have to use WinZip, but 7-zip handles large archives and more files within an archive better (IMHO). Also, I have previously asked about 7-zip having the ability to move a file to file and the Developer of 7-zip did respond: https://stackoverflow.com/a/21209385/175063
Try adding -min
<WinzipPath> -min -a -r -en <Dest&Name>.zip <source>
So you minimise the user interface, and it should not show message windows

Batch command to unzip a file without any additional tool

Can any one help me out to find a batch command to unzip a file.
I do not want to use any external tool just want to unzip using .bat file.
Ths is not possible. the windows command line does not provide support for this.

How to zip a file using cmd line?

I want to zip a directory using the batch file command (Windows XP batch file).
For example, if I want to unzip a file means I can use the jar -xf file.zip(java) bat file command.
Like that I want a command line batch to zip a directory.
If you are using Ubuntu Linux:
Install zip
sudo apt-get install zip
Zip your folder:
zip -r {filename.zip} {foldername}
If you are using Microsoft Windows:
Windows does not come with a command-line zip program, despite Windows Explorer natively supporting Zip files since the Plus! pack for Windows 98.
I recommend the open-source 7-Zip utility which includes a command-line executable and supports many different archive file types, especially its own *.7z format which offers superior compression ratios to traditional (PKZIP) *.zip files:
Download 7-Zip from the 7-Zip home page
Add the path to 7z.exe to your PATH environment variable. See this QA:
How to set the path and environment variables in Windows
Open a new command-prompt window and use this command to create a PKZIP *.zip file:
7z a -tzip {yourfile.zip} {yourfolder}
Cross-platform Java:
If you have the Java JDK installed then you can use the jar utility to create Zip files, as *.jar files are essentially just renamed *.zip (PKZIP) files:
jar -cfM {yourfile.zip} {yourfolder}
Explanation:
* -c compress
* -f specify filename
* -M do not include a MANIFEST file
Yes, we can zip and unzip the file/folder using cmd. See the below command and simply you can copy past in cmd and change the directory and file name
To Zip/Compress File
powershell Compress-Archive D:\Build\FolderName D:\Build\FolderName.zip
To Unzip/Expand File
powershell expand-archive D:\Build\FileName.zip D:\deployments\FileName
You can use the following command:
zip -r nameoffile.zip directory
Hope this helps.
Windows 10 has tar command since 2018. It supports zip archive in default. You do not need to install any additional packages nor software.
tar.exe acvf yourfile.zip yourfolder
Compress-Archive in PowerShell does not support 2GB+ files.
The zip Package should be installed in system.
To Zip a File
zip <filename.zip> <file>
Example:
zip doc.zip doc.txt
To Unzip a File
unzip <filename.zip>
Example:
unzip mydata.zip
Zip the folder from cmd by running PowerShell:
powershell "Add-Type -A System.IO.Compression.FileSystem; [IO.Compression.ZipFile]::CreateFromDirectory('folder','archive.zip')"
Unzip:
powershell "Add-Type -A System.IO.Compression.FileSystem; [IO.Compression.ZipFile]::ExtractToDirectory('archive.zip','folder')"
Nothing listed here worked with me. This should be a very simple thing. I post my answer here, if anything because each time I search for "how to zip on the cmd window" I end up on this page, with no solution that works for me.
So here is the one that works with me: zip output_file input_files, as in the screenshot below.

What does "download or create" mean in a tofrodos context?

I keep seeing this phrase "download or create" in tutorials right after tofrodos. What would be an example of how to download or create? I just get stuck in
^
^
^
mode.
apt-get -y install tofrodos
Download or create ZPX_ubuntu_12-04_auto_installer.sh
The author means you need to transfer the "ZPX_ubuntu_12-04_auto_installer.sh" shell script to the server, and if necessary, change to the directory you saved the script in using the cd command, before entering the commands below:
fromdos ZPX_ubuntu_12-04_auto_installer.sh
chmod +x ZPX_ubuntu_12-04_auto_installer.sh
./ZPX_ubuntu_12-04_auto_installer.sh
He seems to be referring to a particular script included in a .zip file posted on a web forum.
You may be able to download the .zip file to your computer, extract it, and then use the sftp or scp program to transfer just the shell script to the server. Alternatively, you could use wget or curl to download the .zip file to the server and then the unzip command to unzip it.
A graphical SFTP client like FileZilla may help for the former approach. The Firefox add-on cliget may help for the latter, especially because the file is hosted on a password-protected web forum.
fromdos is just a utility program to convert a text file from DOS/Windows format to Unix format by stripping out all the carriage return characters. Perhaps using this command is necessary because the author of the script used a Windows text editor or an ASCII-mode FTP transfer before zipping up the file. Of course, you need the file on the server if you are trying to run the command on the server.

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