Dolphin service menu help: preserve file timestamp

Dotan Cohen dotancohen at gmail.com
Fri Dec 17 22:51:24 GMT 2010


On Fri, Dec 17, 2010 at 20:30, Alex Schuster <wonko at wonkology.org> wrote:
> 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
>

Thanks. I have some googling to do, but I'll ask anyway:


> while (( $# ))
Does this mean to go through each CLI argument, something like foreach?


What does the "shift" line do?


>        date=$( ls -l --full-time "$1" |
>                awk '{ print $6" "$7 }' |
>                sed 's/.00000*//g' )
This is pure genius, I was wondering exactly how difficult it would be
to get this info into a variable in the format that touch would use.


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

Actually, this is _exactly_ what I need. Thanks!

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
___________________________________________________
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.


More information about the kde mailing list