Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


changing file creation date

changing file creation date

changing file creation date

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?

RE: changing file creation date

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 touch command.

I hope it works...

RE: changing file creation date

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.

RE: changing file creation date

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)

RE: changing file creation date

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 ...

RE: changing file creation date

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.

RE: changing file creation date

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

RE: changing file creation date

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. ;)

RE: changing file creation date

Elgis meant "Why didn't you read my previous reply before adding to the thread?" And he has a point really. <smile>

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.

RE: changing file creation date

i read the whole message thread and no one talks about what "change" time is, and how to modify that attribute.

RE: changing file creation date

The "touch" command can be used to change the "accessed" time or the "modified" time of a file.

"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close