Touch -d forms

Dazed_75 lthielster at gmail.com
Sat Mar 30 00:54:43 MST 2013


On Fri, Mar 29, 2013 at 4:42 PM, der.hans <PLUGd at lufthans.com> wrote:

> Am 29. Mar, 2013 schwätzte Dazed_75 so:
>
> moin moin,
>
>
>  Looking to change some file dares to 14 hours later than the current file
>> date/time stamps (they are NOT all the same).  I was thinking some form of
>> the -d option would work but nothing I have tried works-
>>
>
> $ date; touch -d "$( date -d "+14 hours" +%Y%b%d )" /tmp/fred; ls -l
> /tmp/fred Fr 29. Mär 16:57:45 MST 2013
> -rw-r--r-- 1 lufthans lufthans 0 2013-03-30 01:13 /tmp/fred
>
> The "+14 hours" only works with GNU date, but that's what we get on
> GNU/Linux. BSD date really didn't like it :).
>
> ciao,
>
> der.hans
>

This is close but not quite.  Maybe I could have explained it better.  I
have taken a LOT if video clips here in Thailand.  Unfortunately, the
camera clock was still set for Arizona time until several days into the
trip.  Now that I have fixed that I want to re-timestamp the first 100 or
so to have the timestamp adjusted +14 hours.  Here is what I get from
der.Hans' script:

    larry at sunfish:~/tempwork$ ls -l target; date; touch -d "$( date -d "+14
hours" +%Y%b%d )" target; ls -l target
    -rw-rw-r-- 1 larry larry 0 Mar 24 18:18 target
    Fri Mar 29 23:55:49 MST 2013
    touch: invalid date format `2013Mar30'
    -rw-rw-r-- 1 larry larry 0 Mar 24 18:18 target
    larry at sunfish:~/tempwork$


I can fix the date format I believe, but the target's timestamp should end
up being Mar 25 08:18, not Mar 30 13:55.  The reason I want a script or
compound command to do it is so i don't have to figure out the +14 hours
100+ times and issue 100+ touch commands.

Thanks, I hope I can get the timestamp extracted to a variable and use that
to replace the date command (if I don't fall asleep first :-)

Larry




> --
> #  http://www.LuftHans.com/        http://www.LuftHans.com/**Classes/<http://www.LuftHans.com/Classes/>
> #  Free, Libre, and Open Source enthusiasts are collaborators. Maybe we're
> #  involved for slightly different reasons, but in the end, we're all
> #  essentially trying to go the same direction. -- der.hans, 2012Jan25
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>



-- 
Dazed_75 a.k.a. Larry

Please protect my address like I protect yours. When sending messages to
multiple recipients, use the BCC: (Blind carbon copy). Remove addresses
from a forwarded message body before clicking Send.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20130330/9df9b7f6/attachment.html>


More information about the PLUG-discuss mailing list