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