| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Date: | Sun, 25 May 2003 17:06:19 -0700 (PDT) |
| From: | "Joseph I. Davida" <jd AT adsl-63-198-56-213 DOT dsl DOT snfc21 DOT pacbell DOT net> |
| Message-Id: | <200305260006.h4Q06J4j096547@adsl-63-198-56-213.dsl.snfc21.pacbell.net> |
| To: | wayne AT cs DOT unisa DOT edu DOT au |
| Subject: | Re: Time Stamps For Executables? |
| Cc: | cygwin AT cygwin DOT com |
| Reply-To: | jd108 AT pacbell DOT net |
| In-Reply-To: | <00b301c2f8f3$b8ca1cf0$6500a8c0@Pokemon> |
I am having a similar problem with the touch command.
It is NOT modifying the Create and Modify times of
a file.
A while back I had a virus which set the dates
on the windows dir and everyting beneath it to
the year 2031. So, Since I wanted to restore them
to as cloase as the time I installed the system,
I used a script to find and touch these files.
After script was done, ls -l showed still the year 2031.
So, what can I resort to to rstore the creation
and modification times to more sane values?
Here is the script I used:
#!/usr/bin/bash
cd /cygdrive/c/windows
# ff is a file with the date when I installed the system.
# So anything newer in change and modification
# times, will be saved in /tmp/$$
# I chose the hour 12 pm as the time.
find . -newercm /tmp/ff -print > /tmp/f$$
while [ true ]; do
read filename
[ "x$filename" = "x" ] && break
if [ -d "$filename" ]; then
ll=`ls -ld "$filename"`
else
ll=`ls -l "$filename"`
fi
year=`echo $ll | awk '{ print $8 }'`
day=`echo $ll | awk '{ print $7 }'`
month=`echo $ll | awk '{ print $5 }'`
if [ "$year" = "2031" ]; then
case $month in
Jan) mm=01 ;;
Feb) mm=02 ;;
Mar) mm=03 ;;
Apr) mm=04 ;;
May) mm=05 ;;
Jun) mm=06 ;;
Jul) mm=07 ;;
Aug) mm=08 ;;
Sep) mm=09 ;;
Oct) mm=10 ;;
Nov) mm=11 ;;
Dec) mm=12 ;;
esac
case $day in
1|2|3|4|5|6|7|8|9)
dd=0$day ;;
*) dd=$day ;;
esac
touch -acm -t 2003$mm$dd1200 "$filename"
fi
done < /tmp/f$$
Cheers,
Joe
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |