Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Western NY, USA
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Timestamp on folders

    I would like to copy an entire directory structure and maintain the original timestamps on the folders. Is there a way to do this.

    I have tried copy, xcopy and roboCopy. roboCopy works sometimes but is not consistant.

    An alternative would be to update the timestamp after the folders are created. However the version of "Touch.exe" which ships with the NT Resourse Kit does not allow a time to be passed as a parameter, as the Unix version does.

    If my memory serves me correcly, there are some API calls to accomplish this, but writting my own code seems like the hard way to solve a simple problem.

    Anyone had experience with this? Thanks.

  2. #2
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Timestamp on folders

    Have you tried a backup, then restoring to the ('copy') destination folder?

  3. #3
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Timestamp on folders

    My version of TOUCH (1996/07/25 13:51, 47376 bytes) is used as follows:

    TOUCH [/t year month day hour min sec] files
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  4. #4
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Western NY, USA
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Timestamp on folders

    Thanks. If I type Touch, with no params, the help I get is simply [-cf] file .... However /t does work. However, I need to update folder times and now I find touch does not work on folders. Backup and Restore does not work on the folders either. I have not tried the API call SetFileTime, but I suspect it also will not work.

    I remember many years ago, when disk volumes were small, using Norton's Utilities to edit the FAT table and if my memory is any good, the times were able to be edited. In this case however, editing one by one is not a choice, since we are moving large volumes of data from one area to another.

  5. #5
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Timestamp on folders

    If I do TOUCH or TOUCH -? I get an error message, and the (trivial!) help information I indicated. It seems to me that you're using the Posix version!

    You're right that TOUCH doesn't work on directories=folders, and neither does my "other" date/time-changing utility SETFILEDATE.

    I haven't found a utility that changes either the Created or Modified dates on a directory, and who cares about the Last accessed date?
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  6. #6
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Western NY, USA
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Timestamp on folders

    I guess the other option would be to change the time on the system for each directory I want to duplicate.

    What is interesting is Robocopy (Ships with NT Resource kit) will keep the original directory date, sometimes. It is not consistant.

  7. #7
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Timestamp on folders

    ROBOCOPY seems to do a better job of mirroring directories than anything else I know.

    However the principle of the folder date (presumably the Last Modified date?) relates to the last time anyone wrote a file into that directory, so will change whenever any file is written. Only if nothing is touched (sorry, not a pun!) will the folder date remain at the value you originally set it at. So I wouldn't hold out much hope of the value remaining "correct", even if you could set the date on the folder... I suspect ROBOCOPY rewrites the folder date after it's copied all the files.
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •