Re: Dolphin service menu help: preserve file timestamp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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):

#!/bin/bash

while (( $# ))
do
	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"
	shift
done

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

	Wonko
___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.


[Index of Archives]     [Trinity (TDE) Desktop Users]     [Fedora KDE]     [Fedora Desktop]     [Linux Kernel]     [Gimp]     [GIMP for Windows]     [Gnome]     [Yosemite Hiking]
  Powered by Linux