Results 1 to 10 of 10

Thread: [2008] How to rename a file without touching its timestamp?

  1. #1

    Thread Starter
    Addicted Member kaisellgren's Avatar
    Join Date
    Jan 2006
    Posts
    149

    [2008] How to rename a file without touching its timestamp?

    Hello,

    How can I rename a file without changing its timestamp(s)? You know all files have the last access on and so on and I would like to rename file without touching it.

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [2008] How to rename a file without touching its timestamp?

    I don't think you can.

  3. #3

    Thread Starter
    Addicted Member kaisellgren's Avatar
    Join Date
    Jan 2006
    Posts
    149

    Re: [2008] How to rename a file without touching its timestamp?

    There must be an option since I can manually rename files in Windows without changing any timestamps.

  4. #4
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [2008] How to rename a file without touching its timestamp?

    Quote Originally Posted by kaisellgren
    There must be an option since I can manually rename files in Windows without changing any timestamps.
    Are you sure on this?... Whenever you access a file, the Date Accessed attribute is updated.... And to rename a file, you must access it... You can see this by select a folder in Windows Explorer, change the view to details and customize your detail view to include the Date Accessed field. Now just pick any file and note the date accessed on it... Wait a few minutes and rename that file... Refresh the screen (by go to another folder then back) and bang... the date accessed field now is updated with the new value.

  5. #5

    Thread Starter
    Addicted Member kaisellgren's Avatar
    Join Date
    Jan 2006
    Posts
    149

    Re: [2008] How to rename a file without touching its timestamp?

    Yes. Date created, accessed and modified remained the same after renaming files manually.

  6. #6
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [2008] How to rename a file without touching its timestamp?

    Quote Originally Posted by kaisellgren
    Yes. Date created, accessed and modified remained the same after renaming files manually.
    Did you refresh the screen after renaming a file?

  7. #7
    Frenzied Member
    Join Date
    May 2006
    Location
    Toronto, ON
    Posts
    1,093

    Re: [2008] How to rename a file without touching its timestamp?

    Quote Originally Posted by kaisellgren
    Yes. Date created, accessed and modified remained the same after renaming files manually.
    I just tried it out and the Date Accessed field changed after a rename, even if I didn't refresh the screen.

  8. #8
    Frenzied Member
    Join Date
    May 2006
    Location
    Toronto, ON
    Posts
    1,093

    Re: [2008] How to rename a file without touching its timestamp?

    <double post>

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2008] How to rename a file without touching its timestamp?

    When you System.IO.File.Move() (to rename), you should still have the same create and modified date on it. If you don't, and it shouldn't come to this, you can still use the System.Io.File.SetCreationTime()/SetLastAccessTime()/etc() methods. Incidentally, a lot of the major world religions wouldn't be so disparate if the .NET framework had existed back then, as we'd all have one SetCreationTime() and no arguments.

  10. #10
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2008] How to rename a file without touching its timestamp?

    Quote Originally Posted by mendhak
    Incidentally, a lot of the major world religions wouldn't be so disparate if the .NET framework had existed back then, as we'd all have one SetCreationTime() and no arguments.
    I just reported this post and they think they will impose a 10 day ban.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

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



Click Here to Expand Forum to Full Width