Operating System - HP-UX
1834634 Members
3332 Online
110069 Solutions
New Discussion

Re: change date time of file

 
karan_3
Advisor

change date time of file

hi
Actually i want to change the date and time of one file .how can i do this one.is it possible .


waiting for the rply
Thanks & regards
karan
7 REPLIES 7
Mel Burslan
Honored Contributor

Re: change date time of file

touch MMDDhhmm[.ss]

MM 2 digit month
DD 2 digit day of the month
hh 2 digit hour military format 00-23 range
mm 2 digit minute 00-59 range
ss 2 digit seconds 00-59 range [optional]

HTH
________________________________
UNIX because I majored in cryptology...
Mel Burslan
Honored Contributor

Re: change date time of file

duh.. followed by file name ofcourse

i.e.,

touch MMDDhhmm[.ss] filename

{trying to cut down coffee here}
________________________________
UNIX because I majored in cryptology...
karan_3
Advisor

Re: change date time of file

hi
but file has already created . i dont want to create a new file .i want to modify the already crreated file.
thanks & regards
karan
Patrick Wallek
Honored Contributor

Re: change date time of file

touch WILL modify the file if it already exists.

# man touch

for details.
Devesh Pant_1
Esteemed Contributor

Re: change date time of file

don't be afraid just touch it man :-)

Devesh
Matthew_50
Valued Contributor

Re: change date time of file

root@test /tmp/test> prealloc myfile 1000
root@test /tmp/test> ll
total 2
-rw-rw-rw- 1 root sys 1000 Jun 25 21:17 myfile
root@test /tmp/test> date
Sat Jun 25 21:17:57 EAT 2005
root@test /tmp/test> touch 04300000 myfile
root@test /tmp/test> ll
total 2
-rw-rw-rw- 1 root sys 1000 Apr 30 00:00 myfile
root@test /tmp/test>
Nguyen Anh Tien
Honored Contributor

Re: change date time of file

Use touch command pls.
#touch filename
HP is simple