Operating System - HP-UX
1753746 Members
4995 Online
108799 Solutions
New Discussion юеВ

'touch' as one year old timestamped file

 
nathnp
New Member

'touch' as one year old timestamped file

Anybody knows how to change the timestamp of a file for previous year.
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: 'touch' as one year old timestamped file

Hi:

The manpages are an incredible source of information. For example to change the modification timestamp of a file to one year ago today, you could do:

# touch -mt 200808231246 /tmp/foo

http://www.docs.hp.com/en/B3921-60631/touch.1.html

Regards!

...JRF...
Jestin John Chacko
Regular Advisor

Re: 'touch' as one year old timestamped file

Dear,

use touch command it will change only the timestamp
Steven Schweda
Honored Contributor

Re: 'touch' as one year old timestamped file

> The manpages are an incredible source of
> information.

Ineresting. I usually find them to be the
exact opposite: a credible source of
information.
James R. Ferguson
Acclaimed Contributor

Re: 'touch' as one year old timestamped file

Hi (again):

A generalized solution could be accommodated with Perl:

# perl -e '$now=time;utime $now,$now-(60*60*24*365),@ARGV' /tmp/foo /tmp/bar

Pass one or more file names as arguments as shown. The modification ('mtime') of each argument will be changed to one year prior.

@ Steven: Yes, you got me :-)

Regards!

...JRF...
Lijeesh N G_1
Respected Contributor

Re: 'touch' as one year old timestamped file

Hi,

#touch -mt