How can I use the 7-Zip CLI (7za.exe) on Windows to create .tgz archives, as I use tar zcvf archive.tgz source_files
on Linux?
Dherik
6502 gold badges6 silver badges16 bronze badges
asked Sep 26, 2011 at 11:13
0
answered Jan 6, 2020 at 10:04
SerhiySerhiy
4441 gold badge5 silver badges16 bronze badges
If you’d like to do it in a one-liner:
7za.exe a -ttar -so -an source_files | 7za.exe a -si archive.tgz
The -an
switch tells 7-Zip not to parse the archive_name command line parameter that’s normally required.
answered Sep 26, 2011 at 13:24
afrazierafrazier
23k3 gold badges60 silver badges88 bronze badges
5
If you’re just compressing 1 file into the tarball then 7za a archive.tgz source_file
will work.
If you want to add lots of files to the tar then you need to do it in two steps:
Create the tar 7za a archive.tar source_files
Then compress it 7za a archive.tgz archive.tar
And, optionally, delete the ‘temporary’ tar del archive.tar
answered Sep 26, 2011 at 12:49
Chris KentChris Kent
1,41111 silver badges14 bronze badges
1
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.
Windows 10, Windows 11, Windows 7, Windows 8, Windows Server, Windows Vista, Windows XP
- 23.10.2021
- 13 620
- 1
- 28.09.2023
- 32
- 32
- 0
- Содержание статьи
- Создание архива tar.gz в 7-Zip
- Комментарии к статье ( 1 шт )
- Добавить комментарий
Популярный в среде UNIX-подобных операционных систем формат архива tar.gz, появился в далеком 1992 году вместе с утилитой gzip. Тем не менее, не смотря за столь большой промежуток времени, в среде операционных систем Windows данный формат не получил особого распространения, и как итог, его поддержка стандартными средствами Windows отсутствует. К счастью, большинство архиваторов без проблем работают с данным форматом, к примеру бесплатный 7-Zip, о работе с которым мы сейчас и поговорим.
Создание архива tar.gz в 7-Zip
Скачать архиватор 7-Zip можно с его официального сайта.
- Открываем 7-Zip, и выбираем файлы, которые планируем заархивировать, после чего нажимаем на кнопку «Добавить«.
Альтернативный вариант — в Проводнике находите нужные файлы или папки, выделяете их, и вызываете контекстное меню, в котором выбираете пункт «7-Zip — Добавить к архиву…«.
- В окне создания архива выбираем формат архива tar. Сейчас уровень сжатия установить не получиться, поскольку формат tar его не поддерживает, но мы сможем сжать архив на следующем этапе.
- Теперь, нужно заархивировать ранее полученный архив формата tar. Проделываем те же действия, что и ранее, с только что сделанным архивом, только на этот раз выбираем формат архива gzip. Так же можно установить желаемый уровень сжатия.
- После этого, на выходе получится архив формата tar.gz.
How can I use the 7-Zip CLI (7za.exe) on Windows to create .tgz archives, as I use tar zcvf archive.tgz source_files
on Linux?
Dherik
6502 gold badges6 silver badges16 bronze badges
asked Sep 26, 2011 at 11:13
0
answered Jan 6, 2020 at 10:04
SerhiySerhiy
4441 gold badge5 silver badges16 bronze badges
If you’d like to do it in a one-liner:
7za.exe a -ttar -so -an source_files | 7za.exe a -si archive.tgz
The -an
switch tells 7-Zip not to parse the archive_name command line parameter that’s normally required.
answered Sep 26, 2011 at 13:24
afrazierafrazier
23k3 gold badges60 silver badges88 bronze badges
5
If you’re just compressing 1 file into the tarball then 7za a archive.tgz source_file
will work.
If you want to add lots of files to the tar then you need to do it in two steps:
Create the tar 7za a archive.tar source_files
Then compress it 7za a archive.tgz archive.tar
And, optionally, delete the ‘temporary’ tar del archive.tar
answered Sep 26, 2011 at 12:49
Chris KentChris Kent
1,41111 silver badges14 bronze badges
1
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.
How to create tar.gz archive of my files in Windows to upload and extract in cPanel?
asked May 27, 2012 at 12:09
ShamasShamas
1,0272 gold badges10 silver badges10 bronze badges
4
1 Answer
tar.gz file is just a tar file that’s been gzipped. Both tar and gzip are available for windows.
If you like GUIs (Graphical user interface), 7zip can pack with both tar and gzip.
answered May 27, 2012 at 12:20
qwertyboyqwertyboy
1,57615 silver badges25 bronze badges
4
If you need to create gzipped tar archives on Windows, you can use 7-Zip. However, this implies first creating a tar
archive and second adding the tar archive to a gz
archive.
Here is how to do this in one step. We’ll create a little batch file and integrate it into the Windows Explorer’s Send To: context menu.
Download the 7-Zip commandline tool and extract the file 7za.exe
in your user profile folder (something like C:\Users\USERNAME
on Windows 7).
In your user profile folder, create a new batch file targz.bat
using the following code:
@echo off rem Create a tar.gz archive with 7-zip commandline 7za rem Author: Joachim Werner <joachim.werner@diggin-data.de> rem Requirements: 7za.exe in the user dir (C:\Users\USERNAME) echo Create a tar.gz archive echo Directory: %1 cd %1\.. rem Path to 7za.exe: set SEVENZA=C:\Users\jwerner\7za rem get directory basename set BASENAME=%~n1 rem path and filename for tar set TAR=%cd%\%BASENAME%.tar rem create tar %SEVENZA% a -ttar %TAR% %1 rem create tar.gz %SEVENZA% a -tgzip %TAR%.gz %TAR% rem remove tar del %TAR% dir %BASENAME%* pause
In the Windows Explorer, copy this batch file.
Find your Send To… folder. On Windows 7, this should be
C:\Users\USERNAME\AppData\Roaming\Microsoft\Windows\SendTo
In this folder, paste the copied batch file as a link.
Now to create a tar.gz
archive of a folder and its content, you can right-click it and select Send To... \ targz.bat Link
. A command prompt will open, create the file and list the folder and archive file.
Enjoy!