Re: Problem with spaces in filenames
- From: Peter Harvey <pah06 uow edu au>
- To: Nautilus List <nautilus-list gnome org>
- Subject: Re: Problem with spaces in filenames
- Date: Sun, 16 May 2004 22:03:55 +1000
On Fri, 2004-05-14 at 23:51, Lars Strojny wrote:
> On Fri, 14 May 2004 13:39:37 +0200
> Heinrich Rebehn <rebehn ant uni-bremen de> wrote:
>
> [...]
> > I used gimp simply as an example. Actually i want to resize images with
> > ImageMagick simply by dropping them onto the launcher.
> >
> > Ok, i will wait then until Nautilus-2.6 becomes stable on getoo.
> [...]
>
> You can do this by using the nautilus-script-engine. Create a small
> script which does your action and add their an entry, which
> replaces %20 with " " and then gimp and the other stuff should
> work.
>
> Example:
> #!/bin/bash
> FILES=$(echo ${NAUTILUS_I_FORGET_THE_NAME_OF_THE_VAR} | sed s/"%20"/" "/g)
> gimp-remote -n ${FILES}
A possibly better piece of shell script is this:
FILE=$(echo -e "$(echo ${NAUTILUS_I_FORGET_THE_NAME_OF_THE_VAR} | sed -e 's/^file:\/\///' -e 's/\\/\\\\/g' -e 's/%/\\x/g')")
I use this my gnome thumbnailer scripts to convert file URIs into usable
filenames. Maybe in this case, if there is no file:// prefix, you can
drop part of the sed expression, to create a script called launch-gimp:
#!/bin/bash
FILE=$(echo -e "$(echo ${NAUTILUS_I_FORGET_THE_NAME_OF_THE_VAR} | sed -e 's/\\/\\\\/g' -e 's/%/\\x/g')")
gimp-remote -n ${FILE}
For those interested, it:
1. Uses sed to convert any \ to \\, and % to \x.
2. Gives the result to echo -e to interpret any \x?? sequences to
the matching characters (reading the ?? as hexadecimal numbers).
3. Stores the result.
Hope that helps.
--
Peter Harvey.
Mostly Quiet.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]