Results 1 to 11 of 11

Thread: How to set Creation date for file...

  1. #1
    Join Date
    May 2007
    Posts
    110
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X

    Default How to set Creation date for file...

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

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set Creation date for file...

    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.

  3. #3
    Join Date
    May 2007
    Posts
    110
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to set Creation date for file...

    Quote Originally Posted by marcel View Post
    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....

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to set Creation date for file...

    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.

  5. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set Creation date for file...

    or being able to modify the mileage of your car.
    That is possible and some people do that

  6. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set Creation date for file...

    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.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to set Creation date for file...

    Quote Originally Posted by marcel View Post
    That is possible and some people do that
    The same applies to uptime

  8. #8
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to set Creation date for file...

    Quote Originally Posted by wysota View Post
    The same applies to uptime
    Without modifying the kernel sources?

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to set Creation date for file...

    Quote Originally Posted by momesana View Post
    Without modifying the kernel sources?
    Of course. Never underestimate the power of the Dark Side

  10. #10
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set Creation date for file...

    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.

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to set Creation date for file...

    There are surely easier ways, but /proc/kcore and gdb are a crude/h4x0r way to do it too.

Similar Threads

  1. to set date and time in the file info of two days back
    By thomasjoy in forum Qt Programming
    Replies: 1
    Last Post: 11th October 2007, 16:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.