26

Please anyone help me in creating Custom Options for Compress and Extract Here in Thunar File manager

Please help me...

user275472
  • 361
  • 1
  • 3
  • 3

2 Answers2

25

No need to create custom options: you just need to install the thunar-archive-plugin to have both Compress and Extract Here options.

You may install it with the following command:

 sudo apt-get install thunar-archive-plugin 

After installing (and closing all previous instances of Thunar), you will find both options in Thunar's right-click menu.

Source

Enrico
  • 366
0

I often prefer to extract zip files in a directory whose name is as the archive file name without the extension, it could be done with a script to handle different extensions with case condition in the script, but currently the zip extension is the one that happen to require me to do this operation, so I obtained the desired result with:

In thunar from the menu Edit->Configure Custom Actions...

press + and fill the basic tab with

Name: unzip there

Description: extract in a new directory named as the zip file without extension

Command:

bn=`basename -s .zip %n`;mkdir "$bn"&&unzip -d"$bn" -qqnXK %f

This command intentionally (with && and option -n) will not expand over an already existing directory with the desired name to avoid UI interfere too much with file system. Only if the directory results to be new, it will have the expanded content. You might choose similar commands for other archive types and extraction commands or handle all of them within a script.

Then fill the Appearance Conditions tab with:

File pattern: *.zip

an expand.sh script specified in Command: might handle all archive types, one case for each archive type distinguished by the script by the extension, in that case the File pattern would be *.zip;*.arj;*.lzh;*.rar and so on.

Appears if selection contains: [✓] other files

thunar (at least up to version 4.18.10) requires checked the option [✓] other files, otherwise it will never show the custom action (despite the File pattern: could seem capable to define already the context, is not)

See documentation in https://docs.xfce.org/xfce/thunar/custom-actions


If you want to compress by right click over a selected files/directories set in thunar, create the custom action in menu Edit->Configure Custom Actions...->+, for example with

Name: compress to zip

Command: zip -ryx- %n %F

%n it will pick the first filename or directory name of the selection and set it as the chosen name of the archive (with .zip extension),

or tar zcf %n %F if you prefer to compress (once) in .tar.gz format.

and check [✓] Directory and all Appears if selection contains: checkboxes

About the command, you might prefer to compress (and in case update the archive) the selection always to a fixed filename in the working directory called for example thunarSelection.zip, if that's your preference

Name: compress to thunarSelection.zip

Command: zip -uryx- thunarSelection %F -X thunarSelection.zip

in this case choosing zip (which is an archive with files index) will also make quick to maintain update an archive

MARco
  • 1