In dired+
in Emacs 23.2.1 on a Debian Squeeze variant I selected four files with *
and then pressed Z
to compress them. I answered y
to the prompt and saw some status updates in the mini-buffer. Where do I find the compressed file? I tested on one file (C-u
Z
) and Emacs ran gzip on the one file and made it a .gz file. How do I [tar and] compress marked files in Emacs?
(To preempt any philosophical or methodological discussions about tar, gzip, other formats and archives in general, all I want is the four files to be stored in one file as compressed data. If that can be achieved via tar and gzip or compressing each directly into an archive doesn't matter.)
You can also archive files just by marking and copying them to an archive file.
For example, mark several files in dired, and select
m-x dired-do-copy
.When prompted for destination, type
test.zip
. The files will be added to the zip archive automatically.You can also uncompress files by selecting them in dired and running the command
dired-do-extract
To set this up, look at the following variables: dired-to-archive-copy-alist dired-extract-alist
Here's my setup, which has served me for many years...
Platform: Ubuntu
Requirements
System:
sudo apt-get install atool
Emacs:
M-x package-list-packages
C-s dired-atool RET
i
x
Solution
1) Mark the files in dired buffer.
2) M-x dired-atool-do-pack NOTE: Make sure that shell-file-name is set to "/bin/bash".
If
dired+
is anything likedired
, you can mark the files with m and then hit ! (to run a shell command on the marked files) and specify the command astar -czf foo.tar.gz *
(the*
is a special marker that is replaced by the names of the marked files).