This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Time Stamps For Executables?

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:


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"`
		ll=`ls -l "$filename"`
	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 ;;
		case $day in
			   dd=0$day ;;
			*) dd=$day ;;
		touch -acm -t 2003$mm$dd1200  "$filename"
done < /tmp/f$$



Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]