[Thunar-dev] Stripping file extension in custom actions

Glide glide at ifrance.com
Thu Mar 9 16:57:36 CET 2006


It's not about Thunar but here is a solution using bash. Create an executable script called convertpng.sh with

#!/bin/bash
for file in $*
do
  convert [your options here] "$file" "${file%.*}.png"
done

Then create a custom action calling that script with:
/path/to/convertpng.sh %F

It works with multiples files.

Bonne journée :)


On Thu, 9 Mar 2006 16:48:46 +0100
Xavier Dectot <xavier.dectot at culture.gouv.fr> wrote:

> My question probably is stupid, but I can't seem to find the answer, so
> here I come : I'm trying to create a custom action that would allow me
> to convert images to PNG format. So I created a custom action using
> imagemagick :
> 
> convert %n %n.png
> 
> The problem is : with this method, I end up with a double extension
> (exemple.tiff is converted to exemple.tiff.png).
> 
> Is there anyway I can strip %n of it's extension ? I'm sure there is an
> obvious one I'm not seeing (else, I'll just script something...).
> 
> Thanks for the help (and keep up the good work).
> _______________________________________________
> Thunar-dev mailing list
> Thunar-dev at xfce.org
> http://foo-projects.org/mailman/listinfo/thunar-dev



More information about the Thunar-dev mailing list