PDA

View Full Version : How to set Creation date for file...



santosh.kumar
12th October 2007, 12:56
Hi

Query: How to set the file time...if anybody knows help me..

Reply : For Unix and Mac, you may want to look at utime(). Bring up a terminal window and type: man utime

Query: when i use UTime it change only Access time and Modification Time ....But we cannot change the created date and time....UTime function second argument struct change only Access and Modified date.....But I want to change the Created date.....


if anybody have idea help me....

marcel
12th October 2007, 15:03
It is not logical to have the possibility to change the created time stamp. What is the use for that, if the file was already created?

A workaround is to delete the file and then create it again. This is one way to reset the created time.

santosh.kumar
12th October 2007, 15:31
It is not logical to have the possibility to change the created time stamp. What is the use for that, if the file was already created?

A workaround is to delete the file and then create it again. This is one way to reset the created time.

we r using FSCreateFile and FWWriteFork Mac API to create the file and write the file...We have already creation date data of file...But whenver i m creating this file its date will be current date....But I have to set the Original created date of file from list....so that i want to set the set the created date of file....

momesana
12th October 2007, 15:55
As marcel said, creation date does what it says: describe the date when the while was created. If someone could change that value, the value would be useless. Its like being able to change the uptime of a linux machine or being able to modify the mileage of your car.

marcel
12th October 2007, 16:00
or being able to modify the mileage of your car.

That is possible and some people do that :)

marcel
12th October 2007, 16:09
we r using FSCreateFile and FWWriteFork Mac API to create the file and write the file...We have already creation date data of file...But whenver i m creating this file its date will be current date....But I have to set the Original created date of file from list....so that i want to set the set the created date of file....

if you really want to do it, then set the time back to the creation date you already have and create the file.

wysota
12th October 2007, 17:15
That is possible and some people do that :)

The same applies to uptime :)

momesana
12th October 2007, 17:58
The same applies to uptime :)
Without modifying the kernel sources?

wysota
12th October 2007, 18:41
Without modifying the kernel sources?

Of course. Never underestimate the power of the Dark Side ;)

marcel
12th October 2007, 18:46
I think so. I think it could be done with a kernel module, but I don't exactly know how.
I'm looking for the uptime sources right now.
I believe it can be done if the kernel module will replace the functional part of the kernel that is used by uptime to report at least the uptime.

wysota
12th October 2007, 18:50
There are surely easier ways, but /proc/kcore and gdb are a crude/h4x0r way to do it too.