Dolphin service menu help: preserve file timestamp

Alex Schuster wonko at
Fri Dec 17 18:30:44 GMT 2010

Dotan Cohen writes:

> Hi all, I have a Dolphin service menu that converts from CP1255 to UTF-8:
> Exec=iconv -f CP1255 -t UTF-8 %u > %f-utf8
> However, it is important to me that the file's timestamp not be
> altered. How would I go about doing this? Would I need to write a bash
> script then call that from the Exec line, instead of doing it all in
> the .desktop file itself?

Yes. Something like this (untested):


while (( $# ))
	date=$( ls -l --full-time "$1" |
	        awk '{ print $6" "$7 }' |
	        sed 's/.00000*//g' )
	iconv -f CP1255 -t UTF-8 "$1" > "$1-utf8"
	touch -d "$date" "$1-utf8"

If you want to replace the files, you could proabaly use recode, which keeps 
the time unless told otherwise:
Exec=recode CP1255..utf8 %f

This message is from the kde mailing list.
Account management:
More info:

More information about the kde mailing list