Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing file creation date 2

Status
Not open for further replies.

boobam

IS-IT--Management
Sep 24, 2000
1
US
I noticed on my SUN workstation (running Solaris 2.6 OS)that some of my files had odd dates to them. Is there a UNIX cmd that can change the creation date to reflect the true date created? [sig][/sig]
 
Hello. Normally a Unix system saves the last access time, last modification time of contents, and last modification time of i-node. You can change any of'em with the [tt]touch[/tt] command.

I hope it works... [sig][/sig]
 
Hi I would like to know how to get unix file creation date in Unix. I am using Sun OS. All I get is the latest modification dates and time.
 
If it is present on your system, the 'stat' command will print this information. Here's a sample:

$ stat /etc/protocols
File: "/etc/protocols"
Size: 1567 Filetype: Regular File
Mode: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Device: 3,1 Inode: 3984 Links: 1
Access: Sat May 5 17:42:39 2001(00000.08:42:29)
Modify: Wed Jan 12 15:18:52 2000(00479.10:06:16)
Change: Thu Feb 22 12:34:51 2001(00072.12:50:17)
 
you could look at perl (i'm sure you can do it in the OS but i haven't looked hard enough to find it yet) t's got all sorts of facilities to handle file creation/modification/access times ...
 
Can´t all you read... the typical Unix system doesn´t store the creation time of files anywhere... then there is no way you can get or change it!

I hope it works...
Unix was made by and for smart people.
 
Through touch command u can change the creation date of file ;

Let suppose following file

-rwxr-xr-x 1 msi satdev 1237 Mar 24 19:06 user

touch user

It will work.
-rwxr-xr-x 1 msi satdev 1237 Jun 2 19:51 user
 
midrisi, what ElgisRamon was saying is that UNIX doesn't store "creation" time, it stores "access", "modification", and "change" time (see his post on 'touch' and my post on 'stat'). Touch doesn't modify the creation time, it changes access and modification time for a file.

The ironic thing is that he begins his remarks with "can't all you read?", and yet he was the first one to reply to this post. ;)
 
Elgis meant &quot;Why didn't you read my previous reply before adding to the thread?&quot; And he has a point really. <smile> Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
i read the whole message thread and no one talks about what &quot;change&quot; time is, and how to modify that attribute.
 
The &quot;touch&quot; command can be used to change the &quot;accessed&quot; time or the &quot;modified&quot; time of a file. Mike
&quot;Experience is the comb that Nature gives us after we are bald.&quot;

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top