Changing the system clock is a very bad idea, but I guess you figured that 
out and sent the message anyway.  This means that you need a beer.

I think the method I came up with is OK, but if there were a way to tell 
perl not to change the timestamp when the -i option is used, that would be 
better.  I guess this is telling me, but I don't understand it:

http://www.velocityreviews.com/forums/t890336-preserve-timestamp.html

which leads me here:

http://perldoc.perl.org/functions/utime.html

And I don't knoww what to do with that, so I might just stick to what I 
did last time.  ;-)

Mike


On Fri, 6 Sep 2013, Jeremy MountainJohnson wrote:

> In Python the os module should have something to modify it (one would
> think so since it can read this fs meta). If not, you could write a
> script to change the system clock to the original read time stamp of
> the file, modify the file, than change the clock back- would do the
> job of maintaining the modified attribute. Heh, probably not easier,
> but the best my work wired mind could come up with on a Friday :-)
> --
> Jeremy MountainJohnson
> Jeremy.MountainJohnson at gmail.com
>
>
> On Fri, Sep 6, 2013 at 5:17 PM, Mike Miller <mbmiller+l at gmail.com> wrote:
>> I don't know the best way to do this.  I wanted to change some files but I
>> wanted to keep the original timestamps.  So I did it this way:
>>
>> # get the timestamp
>> TIME_STRING=$(date -d "$(stat -c %y FILE)" +"%Y%m%d%H%M.%S")
>>
>> make changes to FILE
>>
>> # change the timestamp back to what it was before the change
>> touch -t $TIME_STRING FILE
>>
>>
>> My use was something like this:
>>
>> for FILE in $(grep -l FOO) ; do
>>    TIME_STRING=$(date -d "$(stat -c %y "$FILE")" +"%Y%m%d%H%M.%S")
>>    perl -pi -e 's/FOO/BAR/' "$FILE"
>>    touch -t $TIME_STRING "$FILE"
>> done
>>
>>
>> So how do you all do this kind of thing?
>>
>> Mike
>> _______________________________________________
>> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
>> tclug-list at mn-linux.org
>> http://mailman.mn-linux.org/mailman/listinfo/tclug-list
> _______________________________________________
> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
> tclug-list at mn-linux.org
> http://mailman.mn-linux.org/mailman/listinfo/tclug-list
>