13

I want to work easier with archives in Emacs dired-mode. And I think that my needs are not only mine.

What I want? Two things in Dired:

  1. z to zip file or dir on cursor (or all marked files/dirs if marks are exists); the name of new archive should be changeable (but if one file/dir selected than name should be the same);
  2. Z to unarchive any type of archives (zip or gz or tar) at cursor; by default content should be placed in new directory with the same name.

How can one achieve that?

  • @Drew, Z in Dired replace (not added another) file with it's *.gz archive (not *.zip). – drobnbobn Mar 8 '16 at 1:51
  • Yes. Apparently (now) that is not what you want. But you have not specified what you want. As I said, the question is not very clear. I suppose that for someone who is familiar with dired-atool, or who takes the time to follow the link and study what it does, the question will be clearer, but you should clarify the question itself, IMHO. – Drew Mar 8 '16 at 3:34
  • @Drew, I rewrite my question. Is it clearly now? – drobnbobn Mar 8 '16 at 3:47
  • 1
    This feature is coming up in the next emacs release (25.1) [Relevant commit]. If you wish, you can try the 3rd pretest (25.0.92) from here. Copying @abo-abo. – Kaushal Modi Mar 8 '16 at 20:25
  • @Drew, sorry, it's my fault! Surely I mean "inside of Dired". – drobnbobn Mar 9 '16 at 0:37
12

emacs 25.x

The emacs 25.1 release will have in-built support for handling different kinds of archives from within dired. Below is the relevant excerpt from the NEWS file (C-h C-n).

+++
*** The command `dired-do-compress' bound to `Z' now can compress
directories and decompress zip files.

+++
*** New command `dired-do-compress-to' bound to `c' can be used to
compress many marked files into a single named archive.  The
compression command is determined from the new
`dired-compress-files-alist' variable.

dired-do-compress | Z

Check out the dired-compress-file-suffixes variable to get a list of supported compressed file formats. The correct program will be used to uncompress a file (or files) when using the Z binding (dired-do-compress).

While the above will uncompress a wide range of formats, it will always compress using gzip.

dired-do-compress-to | c

Check out the dired-compress-files-alist variable to get a list of supported file formats that can be compressed to using the c binding (dired-do-compress-to).

As of emacs 25.1, it supports compressing using tar + (gzip/bzip2/xz) or zip.

  • How to get Emacs 25.1? Or the 25.0.92 version is latest for now? – drobnbobn Mar 10 '16 at 12:34
  • 1
    @drobnbobn Emacs 25.1 isn't out yet, 25.0.92 is the latest beta. – Gilles Mar 10 '16 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.